diff options
author | Eric Blake <eblake@redhat.com> | 2011-04-26 15:07:07 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-04-27 12:47:17 -0600 |
commit | 0c631b51b5f5908decfb7c0da1f94715d6b66c33 (patch) | |
tree | 0de356615ce545c6a6ba5af032a458d851d5759c | |
parent | 02923aada23a2fa2122b415f313730f2e5e266ec (diff) | |
download | gnulib-0c631b51b5f5908decfb7c0da1f94715d6b66c33.tar.gz |
save-cwd: reduce default dependency
save-cwd generally needs only a working fchdir or a working
getcwd(NULL,0). If you are not worried about directories whose
absolute name is longer than PATH_MAX, then reducing the default
dependencies reduces the bulk for this module.
However, there are cases where neither function works on Linux
(an unreadable but searchable directory can be opened by O_SEARCH,
except that Linux doesn't implement that yet; and Linux getcwd()
has issues with long absolute names which glibc does not work
around but which the full-blown getcwd module does). So someone
desiring a truly robust solution needs to import the 'getcwd'
module at the same time as 'save-cwd'.
* modules/save-cwd (Depends-on): Use getcwd-lgpl.
* lib/save-cwd.c: Update comments.
* NEWS: Document the semantic change.
Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | lib/save-cwd.c | 3 | ||||
-rw-r--r-- | modules/save-cwd | 2 |
4 files changed, 14 insertions, 5 deletions
@@ -1,4 +1,9 @@ -2011-04-26 Eric Blake <eblake@redhat.com> +2011-04-27 Eric Blake <eblake@redhat.com> + + save-cwd: reduce default dependency + * modules/save-cwd (Depends-on): Use getcwd-lgpl. + * lib/save-cwd.c: Update comments. + * NEWS: Document the semantic change. getcwd: enhance tests * tests/test-getcwd-lgpl.c: New file, taken from... @@ -9,8 +14,6 @@ * m4/getcwd-abort-bug.m4: Update comment. * m4/getcwd-path-max.m4: Likewise. -2011-04-27 Eric Blake <eblake@redhat.com> - getcwd-lgpl: new module * modules/getcwd-lgpl: New module. * lib/getcwd-lgpl.c: New file. @@ -12,6 +12,11 @@ User visible incompatible changes Date Modules Changes +2011-04-27 save-cwd This module pulls in fewer dependencies by + default; to retain robust handling of directories + with an absolute name longer than PATH_MAX, you + must now explicitly include the 'getcwd' module. + 2011-04-19 close-hook This module has been renamed to 'fd-hook' and generalized. diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 16ffa2c490..5f8eb7ca53 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -50,7 +50,8 @@ The `raison d'etre' for this interface is that the working directory is sometimes inaccessible, and getcwd is not robust or as efficient. So, we prefer to use the open/fchdir approach, but fall back on - getcwd if necessary. + getcwd if necessary. This module works for most cases with just + the getcwd-lgpl module, but to be truly robust, use the getcwd module. Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin, SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it diff --git a/modules/save-cwd b/modules/save-cwd index 02a0723391..974b5962c1 100644 --- a/modules/save-cwd +++ b/modules/save-cwd @@ -9,7 +9,7 @@ m4/save-cwd.m4 Depends-on: chdir-long cloexec -getcwd +getcwd-lgpl fchdir stdbool unistd-safer |