Bug 11643

Summary: Special dot files . and .. exist for both for directories and files
Product: [Yocto Project Subprojects] Pseudo Reporter: Jonathan Liu <net147>
Component: pseudoAssignee: Seebs <seebs>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: Medium+ CC: richard.purdie, seebs, yp.pseudo.watcher, yp.watcher
Version: master   
Target Milestone: 2.5 M3   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jonathan Liu 2017-06-11 05:23:21 UTC
Running outside of pseudo inside an empty directory:
# touch test; ls -l test test/. test/..
ls: cannot access 'test/.': Not a directory
ls: cannot access 'test/..': Not a directory
-rw-r--r-- 1 root root 0 Jun 11 15:15 test


Running inside of pseudo  inside an empty directory:
# touch test; ls -l test test/. test/..
-rw-r--r-- 1 root root 0 Jun 11 15:15 test
-rw-r--r-- 1 root root 0 Jun 11 15:15 test/.

test/..:
total 0
-rw-r--r-- 1 root root 0 Jun 11 15:15 test


This is causing "make headers_install" with Linux kernel (v4.12-rc2 and later) to fail since commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=05d8cba4a1e8c7e2d1f91a24a2f3d26852938a04

This is because in the "$(wildcard $(srcdir)/*/.)" in scripts/Makefile.headersinst will match not only directories, but files as well when run under pseudo. It will also affect any code that determines if a path is a directory based on whether it contains a file with a single dot as the name.
Comment 1 Seebs 2017-06-11 05:27:47 UTC
Huh, that's fascinating. We already had a similar thing about handling of names ending with a slash, but this is a variant I hadn't considered.
Comment 2 Seebs 2018-03-06 15:07:52 UTC
I have a tentative patch for this but I am not super happy with it. It's living in pseudo master now.
Comment 3 Seebs 2018-03-30 21:13:56 UTC
I've revised the patch significantly after someone found bugs in it, and then i found more bugs, and more bugs after that, and then i rewrote the path canonicalization code substantially and it seems okay now.