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

Re: Mass bugfiling potential: 'rules' with space



In chiark.mail.debian.devel, you wrote:

(CCed to Theodore Ts'o because the comments in the Linux code claim he
wrote this stuff in the first place...)

> Isn't it easier to fix the _kernel_?  Just ignore trailing whitespace,
> or can you come up with a way of passing an space as parameter to the
> interpreter (on Linux)?  Look for example at this:
>
>$ cat foo
>#!/usr/bin/make bar baz

(snip)

>make: *** No rule to make target `bar baz'.  Stop.

Yes, that's correct. It's passed as a single argument, which is historic
behaviour.

> NetBSD seems to split on whitespace and pass all the arguments, not
> ignoring trailing whitespace.

No, NetBSD passes a single argument. It's just that it passes "-f "
rather than "-f", and make treats these differently. Your "bar baz"
example will behave in the same way on NetBSD. Now, can anyone find a
reference that suggests that NetBSD is wrong to do this? If not, I'm not
happy about trying to get NetBSD upstream to accept the change.

Just to make it absolutely clear - "#!/usr/bin/make -f " on NetBSD
results in "make" "-f ", *not* "make" "-f" "". I'm inclined to think
that the rules files in question are buggy, and it's just luck that they
happen to run on Linux. Oddly, this does seem to be a deliberate
decision - from fs/binfmt_script.c in the Linux source, we have:

                if ((*cp == ' ') || (*cp == '\t'))
                        *cp = '\0';

Ted, was there any particular reason for this?

Thanks,
-- 
Matthew Garrett | mjg59-chiark.mail.debian.devel@srcf.ucam.org



Reply to: