save-cwd: reduce default dependency
authorEric Blake <eblake@redhat.com>
Tue, 26 Apr 2011 21:07:07 +0000 (15:07 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 27 Apr 2011 18:47:17 +0000 (12:47 -0600)
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>
ChangeLog
NEWS
lib/save-cwd.c
modules/save-cwd

index 8cef5ec..2b6b063 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index 7dd126d..5081dba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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.
 
index 16ffa2c..5f8eb7c 100644 (file)
@@ -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
index 02a0723..974b596 100644 (file)
@@ -9,7 +9,7 @@ m4/save-cwd.m4
 Depends-on:
 chdir-long
 cloexec
-getcwd
+getcwd-lgpl
 fchdir
 stdbool
 unistd-safer