Subject: Re: "xargs: A: No such file or directory"
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Jachym Holecek <freza@liberouter.org>
List: tech-userlevel
Date: 03/30/2005 14:54:52
> > My first thought there is that someone is not considering pathnames
> > with spaces and it hit a file or directory like "A Name With Spaces".
> 
> If so I have no idea where or what it was.  As far as I know (I can't
> tell right now, the machines are at work and turned off) there are no
> such names on the entire machine.
> 
> The only place I can think of that it might possibly have come from is
> that I have LS=A in my environment, because my ls uses $LS - and while
> I used my "std" alias, which rips most localisms out
> 
> alias std 'set path = ( . /bin /usr/bin /sbin /usr/sbin /usr/games ); setenv SHELL /bin/csh; unsetenv HOSTALIASES; unsetenv LD_LIBRARY_PATH; unsetenv LPATH; unsetenv MANPATH'
> 
> it doesn't affect $LS.  But why this would turn into xargs input?
> That's the baffling part.  Even if some Makefile does something like
> LS=/bin/ls and then use ${LS}, I can't see how that would get an A into
> xargs input - or an xargs command, which latter is more likely because
> I can't think of anything xargs could get ENOENT for except its
> command-to-run executable file.

/usr/pkgsrc/mk/platform/NetBSD.mk:
LS?=          /bin/ls

/usr/pkgsrc/mk/bsd.pkg/mk:
print-pkg-size-this:
        @${SHCOMMENT} "This pkg's files" ;                              \
        ${AWK} 'BEGIN { base = "${PREFIX}/" }                           \
                /^@cwd/ { base = $$2 "/" }                              \
                /^@/ { next }                                           \
                { print base $$0 }'                                     \
                <${PLIST}                                               \
        | ${SORT} -u                                                    \
        | ${SED} -e "s/'/'\\\\''/g" -e "s/.*/'&'/"                      \
        | ${XARGS} -n 256 ${LS} -ld                                     \
        | ${AWK} '{ s += $$5; } END { print s; }'                       \
[...]

Note the "| ${XARGS} ... ${LS}". Perhaps that's it?

	Regards,
		-- Jachym Holecek