bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHv2 4/9] save-cwd: reduce dependency


From: Jim Meyering
Subject: Re: [PATCHv2 4/9] save-cwd: reduce dependency
Date: Wed, 27 Apr 2011 09:37:46 +0200

Eric Blake wrote:
> save-cwd needs either a working fchdir or a working getcwd(NULL).
> The only platform where getcwd fixes problems not solved by
> getcwd-lgpl is Linux, but fchdir works there.
>
> * modules/save-cwd (Depends-on): Use getcwd-lgpl.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
>  ChangeLog        |    3 +++
>  modules/save-cwd |    2 +-
>  2 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 1416cf6..8603b51 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,8 @@
>  2011-04-26  Eric Blake  <address@hidden>
>
> +     save-cwd: reduce dependency
> +     * modules/save-cwd (Depends-on): Use getcwd-lgpl.
> +
>       getcwd: enhance tests
>       * tests/test-getcwd-lgpl.c: New file, taken from...
>       * tests/test-getcwd.c: ...old contents.  Rewrite this file to
> diff --git a/modules/save-cwd b/modules/save-cwd
...
> -getcwd
> +getcwd-lgpl

Hi Eric,

Unfortunately, that change would introduce a bug.  save_cwd's
open (".", O_SEARCH) may fail in a directory where getcwd's
function would succeed, while getcwd-lgpl's would not.
Thus, we have to use the robust getcwd module there.

Try calling save_cwd from an unreadable yet accessible directory
whose absolute name is too long for getcwd-lgpl.

This condition will persist as long as we have to worry about
O_SEARCH being defined to O_RDONLY.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]