This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Breakage with [PATCH, libgfortran] PR60324 Handle arbitrarily long path names


On Mon, 19 May 2014, Janne Blomqvist wrote:
> Hello,
>
> some systems such as GNU Hurd, don't define PATH_MAX at all, and on
> some other systems many syscalls apparently work for paths longer than
> PATH_MAX. Thus GFortran shouldn't truncate paths to PATH_MAX
> characters, but rather use heap allocated buffers limited only by the
> available memory. The attached patch implements this, with the
> exception of the backtrace functionality where we cannot use malloc
> since backtrace might be called from a signal handler.
>
> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> 2014-05-19  Janne Blomqvist  <jb@gcc.gnu.org>
>
>     PR libfortran/60324
>     * config.h.in: Regenerated.
>     * configure: Regenerated.
>     * configure.ac (AC_CHECK_FUNCS_ONCE): Check for strnlen and
>     strndup.
>     * libgfortran.h (fc_strdup): New prototype.
>     * runtime/string.c (strnlen): New fallback function.
>     (strndup): New fallback function.
>     (fc_strdup): New function.
>     * io/close.c (st_close): Use fc_strdup.
>     * io/open.c (new_unit): Likewise.
>     (already_open): Likewise.
>     * io/unit.c (filename_from_unit): Likewise.
>     * io/unix.c (unpack_filename): Remove function.
>     (regular_file): Rename to regular_file2, add path argument.
>     (regular_file): New function calling regular_file2.
>     (compare_file_filename): Use fc_strdup.
>     (find_file): Likewise.
>     (delete_file): Likewise.
>     (file_exists): Likewise.
>     (file_size): Likewise.
>     (inquire_sequential): Likewise.
>     (inquire_direct): Likewise.
>     (inquire_formatted): Likewise.
>     (inquire_access): Likewise.
>     * io/unix.h (unpack_filename): Remove prototype.
>     * runtime/main.c (please_free_exe_path_when_done): Change type to
>     bool.
>     (store_exe_path): Use malloced buffer, grow as needed.

This patch broke build for newlib targets; you need AC_DEFINE
clauses for those in the "if-then"-leg where you patched the
"else"-leg. There's also a need for #include <stdlib.h> for the
malloc use in runtime/string.c.

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]