Live data from Hacker News

Apple's libc shells out to Perl to implement wordexp

github.com

41–49 of 49 posts

Re: Apple's libc shells out to Perl to implement wordexp

#41
post #39
post #23

Earlier quoted context omitted.

License-wise: - this piece of code is 2BSD-licensed - it calls out to /bin/sh - on OS X, /bin/sh is hardlinked to /bin/bash - OS X's bash is GPLv2 Forking to shell is the only way to reuse bash's code. More often than not I really wish sh were not bash .

"Forking to shell is the only way to reuse bash's code." well, the other obvius way is to license this piece of code as GPLv2.

AFAIK this is THE reason for GPL. So that you either release your code and contribute to open source or suffer from slower access methods.

Re: Apple's libc shells out to Perl to implement wordexp

#42

Earlier quoted context omitted.

> otool -L /usr/bin/perl /usr/bin/perl: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.14.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

Thanks, much appreciated. I thought there may be some strange cyclic dependency going on, but it seems not.

It would only be a problem if that specific perl command (perl -e 'print join(chr(0), @ARGV), chr(0)' -- args....) or the shell invoking it depended on wordexp(). Recursion is fine as long as it terminates.

Re: Apple's libc shells out to Perl to implement wordexp

#43
post #39
post #23

Earlier quoted context omitted.

License-wise: - this piece of code is 2BSD-licensed - it calls out to /bin/sh - on OS X, /bin/sh is hardlinked to /bin/bash - OS X's bash is GPLv2 Forking to shell is the only way to reuse bash's code. More often than not I really wish sh were not bash .

"Forking to shell is the only way to reuse bash's code." well, the other obvius way is to license this piece of code as GPLv2.

Which would require libc to be GPL, something not even glibc does.

Re: Apple's libc shells out to Perl to implement wordexp

#44
post #39

Earlier quoted context omitted.

"Forking to shell is the only way to reuse bash's code." well, the other obvius way is to license this piece of code as GPLv2.

AFAIK this is THE reason for GPL. So that you either release your code and contribute to open source or suffer from slower access methods.

The BSDs doesn't ship with bash and their wordexp shelling out to /bin/sh doesn't suffer, so I don't see how this is a reason for the GPL.

Re: Apple's libc shells out to Perl to implement wordexp

#45
post #14
post #5

As it's already written in the manual... http://linux.die.net/man/3/wordexp wordexp, wordfree - perform word expansion like a posix-shell So, the implementer decided to take the short route, and just spawn a shell which, essentially, gets passed the input data to wordexp(), to do the work. But, of course, having something that starts with such a comment... /* XXX this is _not_ designed to be fast (...) wordexp is als…

Scroll down, there are many more gems in the comments! ...and what a spelling errors: "This kludge is needed because /bin/sh seems to set IFS to the defualt even if you have set it; We also can't just ignore it because it is hard/unplesent to code around or even a potential security problem because the test suiete explicitly checks to make sure setting IFS 'works'" ESR writes about sloppy spelling: "Write in clear, g…

ESR hasn't been a role model for anything related to programming since, like, 1998.

Re: Apple's libc shells out to Perl to implement wordexp

#46
post #14
post #5

As it's already written in the manual... http://linux.die.net/man/3/wordexp wordexp, wordfree - perform word expansion like a posix-shell So, the implementer decided to take the short route, and just spawn a shell which, essentially, gets passed the input data to wordexp(), to do the work. But, of course, having something that starts with such a comment... /* XXX this is _not_ designed to be fast (...) wordexp is als…

Scroll down, there are many more gems in the comments! ...and what a spelling errors: "This kludge is needed because /bin/sh seems to set IFS to the defualt even if you have set it; We also can't just ignore it because it is hard/unplesent to code around or even a potential security problem because the test suiete explicitly checks to make sure setting IFS 'works'" ESR writes about sloppy spelling: "Write in clear, g…

ESR hasn't been a role model for anything related to programming since, like, 1998.

Re: Apple's libc shells out to Perl to implement wordexp

#47
post #37
post #21

Earlier quoted context omitted.

With respect, is there evidence to support your claim? My direct experience is that I have received value far in excess of what I have had to pay for the Apple products and services I have purchased over the years. For example, I'm typing this reply on my PowerBook, which I use all day, every day in my work. I also have my iPhone with me constantly, and use it heavily. Finally, the Apple brand was said to be worth ab…

OT, but you're still using a Powerbook? That's pretty impressive. Which generation\year was it? I'm guessing you've had to swap out batteries and upgrade hard drive - have you had to modify anything else?

He meant MacBook Pro.

That said, I still have an iBook G4 from 2004 in perfect operation for mail/web/music (though one button is missing).

Re: Apple's libc shells out to Perl to implement wordexp

#48
post #44

Earlier quoted context omitted.

AFAIK this is THE reason for GPL. So that you either release your code and contribute to open source or suffer from slower access methods.

The BSDs doesn't ship with bash and their wordexp shelling out to /bin/sh doesn't suffer, so I don't see how this is a reason for the GPL.

Probably I've written it not clearly enough: "Reason for GPL not allowing you to use code in your own programs, but allowing use through exec: you either release your code and contribute to open source or suffer from slower access methods."

Re: Apple's libc shells out to Perl to implement wordexp

#49
post #44

Earlier quoted context omitted.

The BSDs doesn't ship with bash and their wordexp shelling out to /bin/sh doesn't suffer, so I don't see how this is a reason for the GPL.

Probably I've written it not clearly enough: "Reason for GPL not allowing you to use code in your own programs, but allowing use through exec: you either release your code and contribute to open source or suffer from slower access methods."

ahh, ok; that's clearer
Post reply on HN