Eric Blake wrote: > On 04/27/2011 01:37 AM, Jim Meyering wrote: >> 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. >>> >> 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. > > Hmm, you're right. I'll go with Bruno's suggestion, then, of > documenting that save-cwd "works" with getcwd-lgpl, but is more robust > with getcwd. Coreutils, of course, uses getcwd, so there is no > regression in behavior there, even if the save-cwd module relaxes its > default dependency.
Reducing robustness solely to reduce dependencies... That could introduce a subtle flaw in a package that depends on the robustness -- if the package maintainer doesn't read gnulib's NEWS. Not so sure I like that, but I do recognized the value. I guess it's ok if it's well documented. Be sure to mention in NEWS that by default (without explicit inclusion of the getcwd module), the save-cwd module is no longer robust. >> This condition will persist as long as we have to worry about >> O_SEARCH being defined to O_RDONLY. > > I wonder if anyone on the kernel is working on this.