Comment 12 for bug 977232

Revision history for this message
Sebastian Reichel (sre) wrote :

Hi,

I checked the code, since this is really annoying. This error is *not* upstream's fault. The Debian patch, which fixes the HURD build [0] is broken. I suggest to fix the patch and merge it upstream afterwards. There are multiple problems with the patch:

1. It does lstat(file, &sb) before file has been filled with "/proc/<pid>/cwd", so it does lstat on NULL
2. It should do stat() instead of lstat(), since we are interested in the size of the path and not the size of the directory, which is 0
3. file must be free'd if lstat() fails
4. file must be free'd if size check fails

So the patch introduces 2 errors breaking the code for sure and two potential memory leaks.

Andrew Starr-Bochicchio, you should review patches before applying them.

David Gómez, I guess the updated patch should go upstream. Using the actual path size is a cleaner approach, than using MAX_PATH and is POSIX compatible.

[0] http://patch-tracker.debian.org/patch/series/view/sakura/2.4.2-4/fix_FTBFS4Hurd.patch

-- Sebastian