pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/50955: directory inode 532771 explodes check-interpreter



>Number:         50955
>Category:       pkg
>Synopsis:       directory inode 532771 explodes check-interpreter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 11 21:00:00 +0000 2016
>Originator:     David A. Holland
>Release:        NetBSD (version irrelevant), pkgsrc 20160304
>Organization:
>Environment:
System: NetBSD valkyrie 7.99.1 NetBSD 7.99.1 (VALKYRIE) #18: Fri Feb  5 15:35:14 EST 2016  dholland@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE amd64
Architecture: x86_64
Machine: amd64
>Description:

By tradition on ffs volumes reading a directory returns the binary
contents of the directory file, rather than just yielding EISDIR as
happens in other circumstances.

The first thing in an ffs directory is the struct direct describing
the "." name in that directory. The first field of that is the inode
number. 532771, or 0x00082123, is a perfectly fine inode number; but
on a little-endian volume it appears as 0x23 0x21 0x08 0x00. 0x23 is
also known as '#', and 0x21 is also known as '!'.

You can probably now guess where this is going.

If you build a package and one of the directories under .destdir
happens to get inode 532271, or any other value congruent to 8483 mod
65536 (although 532271 is particularly vexing because the following
0x08 is a backspace so naive tools don't show the ! when printing to a
tty) ... and the package includes a symlink to the directory,
check-interpreter reads through the symlink, gets the contents of the
directory, discovers it begins with #!, and then gets angry because
the following binary gibberish isn't the name of a valid script
interpreter:

ERROR: [check-interpreter.mk] The interpreter " of "/usr/pkgsrc/editors/xournal/work/.destdir/usr/pkg/share/xournal/html-doc/pixmaps" does not exist.

(I believe the reason it printed a single quote as the name is that it
treated the 0x00 after the 0x08 as a null terminator, so it printed
\"\b\" and all that came out on the tty was one quote.)

>How-To-Repeat:

build something (in this case xournal), be extremely unlucky, watch it
fail, scratch head.

>Fix:

check-interpreter should probably skip PLIST entries that aren't
regular files. Or at least, skip directories. There's already a test
to skip things that aren't executable; but of course, directories are
normally executable...

Index: mk/check/check-interpreter.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/check/check-interpreter.mk,v
retrieving revision 1.30
diff -u -r1.30 check-interpreter.mk
--- mk/check/check-interpreter.mk	27 Nov 2015 12:45:04 -0000	1.30
+++ mk/check/check-interpreter.mk	11 Mar 2016 20:56:35 -0000
@@ -56,6 +56,9 @@
 		if [ ! -x "$$file" ]; then				\
 			continue;					\
 		fi;							\
+		if [ -d "$$file" ]; then				\
+			continue;					\
+		fi;							\
 		if [ ! -r "$$file" ]; then				\
 			${DELAYED_WARNING_MSG} "[check-interpreter.mk] File \"${DESTDIR}${PREFIX}/$$file\" cannot be read."; \
 			continue;					\



Home | Main Index | Thread Index | Old Index