<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 11, 2022 at 11:25 PM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 4/11/22 19:03, enh wrote:<br>
> On Mon, Apr 11, 2022 at 3:19 PM Rob Landley <<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a><br>
> <mailto:<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>>> wrote:<br>
> Anyway, if musl and bionic have __freadahead(), I can either #ifdef the glibc<br>
> hack for it in portability.h, or might just move xgetline() into portability.c<br>
> and have it do get_line() on systems that don't have __freadahead(). <br>
> <br>
> you're still screwed on macOS? (oh, except macOS seems to be just the regular<br>
> BSD header, with everything public and "roughly what you'd expect", so that's<br>
> easily done manually too.)<br>
<br>
There's a bunch of stuff in the m4 and glib #ifdefs that show how to do it for<br>
other libraries, although I only really care about 3 and can fall back to<br>
get_line() for the others in portability.c. :)<br>
<br>
But part of my thinking is it's easier to convince the posix guys to standardize<br>
the wrapper if the wrapper is more widely implemented. It's already in musl,<br>
Dragonfly BSD, Z/OS...<br></blockquote><div><br></div><div>yeah, "standardize existing practice" is what they're supposed to do, but they can be pretty slow even then. you might also want to try <a href="https://www.openwall.com/lists/libc-coord/2020/01/30/1">https://www.openwall.com/lists/libc-coord/2020/01/30/1</a>?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> yeah, iirc i added everything that glibc had but didn't even look at musl. (if<br>
> you'd asked me even this morning, i'd have told you musl was a strict subset of<br>
> glibc. TIL.)<br>
<br>
There are a few exceptions.<br>
<br>
> Honestly, I<br>
> have no sympathy for the glibc guys who implemented everything EXCEPT<br>
> __freadahead() because they want to force people to use<br>
> gnugnugnustallmanftaghnlib:<br>
> <br>
> <br>
> citation needed :-)<br>
<br>
If you want a list of what they DID implement, the man page I linked to lists<br>
them. (It's one of them group man pages for a bunch of related features.)<br></blockquote><div><br></div><div>i know what they did do, because bionic got its subset via <a href="http://man7.org">man7.org</a> :-) i just didn't realize until now that musl's set != glibc's set.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you want examples of gnu pressuring people to use their libraries to spread<br>
their license... they've been pretty open about it? Their darling used to be<br>
libreadline before that got cloned...<br>
<br>
<a href="https://www.gnu.org/licenses/why-not-lgpl.en.html" rel="noreferrer" target="_blank">https://www.gnu.org/licenses/why-not-lgpl.en.html</a><br>
<a href="https://news.ycombinator.com/item?id=20772053#:~:text=embraced" rel="noreferrer" target="_blank">https://news.ycombinator.com/item?id=20772053#:~:text=embraced</a><br>
<br>
There are more explicit on-topic references, but... sigh, stuff wanders by over<br>
the years that can be a bit hard to dig up again. They've been at this FOREVER...<br>
<br>
<a href="https://postgrespro.com/list/thread-id/1596439" rel="noreferrer" target="_blank">https://postgrespro.com/list/thread-id/1596439</a><br>
<br>
That whole<br>
<a href="https://www.computerworld.com/article/2732025/gpl-enforcement-sparks-community-flames.html" rel="noreferrer" target="_blank">https://www.computerworld.com/article/2732025/gpl-enforcement-sparks-community-flames.html</a><br>
thing was not my first licensing rodeo. I first encountered the GPL via the EMX<br>
project back in college like a decade before that:<br>
<br>
<a href="https://en.wikipedia.org/wiki/EMX_(programming_environment)" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/EMX_(programming_environment)</a><br>
<br>
My first serious attempt to educate myself on IP law was over 20 years ago now,<br>
sometime before... Grrr, TMF keeps moving their archives around. Lemme splice<br>
together the week with my own archives...<br>
<br>
<a href="https://landley.net/writing/mirror/fool/rulemaker000501.htm" rel="noreferrer" target="_blank">https://landley.net/writing/mirror/fool/rulemaker000501.htm</a><br>
<a href="https://www.fool.com/archive/portfolios/rulemaker/2000/05/02/get-your-copyrights-here.aspx" rel="noreferrer" target="_blank">https://www.fool.com/archive/portfolios/rulemaker/2000/05/02/get-your-copyrights-here.aspx</a><br>
<a href="https://www.fool.com/archive/portfolios/rulemaker/2000/05/03/you-gonna-patent-that.aspx" rel="noreferrer" target="_blank">https://www.fool.com/archive/portfolios/rulemaker/2000/05/03/you-gonna-patent-that.aspx</a><br>
<a href="http://landley.net/writing/mirror/fool/rulemaker000504.htm" rel="noreferrer" target="_blank">http://landley.net/writing/mirror/fool/rulemaker000504.htm</a><br>
<a href="http://landley.net/writing/mirror/fool/rulemaker000505.htm" rel="noreferrer" target="_blank">http://landley.net/writing/mirror/fool/rulemaker000505.htm</a><br>
<br>
I.E. sometime before that.<br>
<br>
I even drove to Boston to talk to Richard Stallman at his office in February<br>
2001. (I'd already mailed him a VHS copy of the musical 1776, so I could explain<br>
he was John Adams and needed ESR's Franklin and Torvalds' Jefferson to get his<br>
agenda through. He didn't take that well, he thought he was Franklin. Sigh.)<br>
<br>
Anyway, I was very interested in the IP considerations and ramifications of all<br>
this stuff because licensing and development model were a big part what made<br>
Linux different, and I wanted to understand it. I think<br>
<a href="https://lkml.org/lkml/2002/6/3/199" rel="noreferrer" target="_blank">https://lkml.org/lkml/2002/6/3/199</a> is why I was cc'd on<br>
<a href="https://mail.gnome.org/archives/foundation-list/2004-September/msg00014.html" rel="noreferrer" target="_blank">https://mail.gnome.org/archives/foundation-list/2004-September/msg00014.html</a> but<br>
it's been a while?<br>
<br>
Oh, and at this LinuxWorld Expo in 2000:<br>
<br>
<a href="https://www.fool.com/archive/portfolios/rulemaker/2000/08/18/is-amds-chip-better-than-intels.aspx" rel="noreferrer" target="_blank">https://www.fool.com/archive/portfolios/rulemaker/2000/08/18/is-amds-chip-better-than-intels.aspx</a><br>
<br>
I attended a talk where Stallman was VERY UNHAPPY with the "application service<br>
provider" problem where people could run GPL code on a server and not share<br>
modifications because they weren't distributing the code! He already was trying<br>
to figure out how to change the license to stop this, but the problem is since<br>
they weren't distributing but merely using copyright didn't actually give him<br>
any leverage. (He later switched to "tivoization" where he was instead basically<br>
undermining first sale doctrine. That might also be where I learned that GPL<br>
can't rely on contract law for anything because there's no "privity of<br>
contract": you haven't got an agreement if you can't say who your agreement is<br>
WITH. Alas the law has shifted a bit since then in truly horrible ways and the<br>
FSF has been on the wrong side of that...)<br>
<br>
So when I launched the first GPL enforcement suits in 2006 it didn't come out of<br>
nowhere. Almost immediately after that the FSF broke the GPL into warring camps<br>
and doomed it to irrelevance, and it took me something like 5 years to work<br>
through the kubler-ross stages of grief. (Maintaining "last GPLv2" versions of<br>
things involved both denial and anger. I did not bargain with the FSF ever<br>
because Rudyard Kipling was right about Danegeld, but there was a lot of<br>
negotation to get SPDX and OSI and github to accept 0BSD...)<br>
<br>
> i'd be genuinely curious to know why glibc doesn't have this (and especially<br>
> "why musl does anyway").<br>
<br>
Because people were patching a #define __MUSL__ into their toolchains so gnulib<br>
could poke at musl's FILE internals.<br>
<br>
<a href="https://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00223.html" rel="noreferrer" target="_blank">https://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00223.html</a><br>
<br>
Rich has always had a weird reluctance to have a #define admitting you're using<br>
musl. (That's why my mcm-buildall.sh has to append it to features.h after each<br>
toolchain build.) Instead he added __freadahead() so autoconf could probe for<br>
that and use it, avoiding the staircase function entirely.<br></blockquote><div><br></div><div>so no-one's even mentioned this to glibc? or they have, and they were happy with people poking at their fields? (might be worth mentioning on libc-coord if no-one's ever even mentioned it to them.)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> i'll have to check what else is in musl's <stdio_ext.h><br>
> that isn't in glibc's. looks like these:<br>
> <br>
> size_t __freadahead(FILE *);<br>
> const char *__freadptr(FILE *, size_t *);<br>
> void __freadptrinc(FILE *, size_t);<br>
<br>
So far I've just needed to answer the one question...<br></blockquote><div><br></div><div>yeah, and __freadahead() does seem the least scary of the three.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <a href="https://linux.die.net/man/3/__fpending" rel="noreferrer" target="_blank">https://linux.die.net/man/3/__fpending</a><br>
> <<a href="https://linux.die.net/man/3/__fpending" rel="noreferrer" target="_blank">https://linux.die.net/man/3/__fpending</a>><br>
> <br>
> They have _fbufsize() but not how much of the buffer is used. That's just sad.<br>
> <br>
> that does seem of questionable utility now you bring it up. (though as you<br>
> pointed out on the posix list, unless you _know_ you can seek on a stream, all<br>
> of this is pretty dodgy...)<br>
<br>
I need it because I CAN'T seek. If I could, I could just count the bytes<br>
returned by getline() and seek the fd to that position after calling fileno().<br>
<br>
The number I'm looking for is "how many bytes can I read from the FILE pointer<br>
without triggering another underlying read from the fd" because I can't re-read<br>
that data from the fd. So I need to fetch the data out of the buffer and handle<br>
it before calling the "takes the rest as a filehandle" function. In the case of<br>
patch.c, something like reading the remaining FILE * data into toybuf() and<br>
doing a write() to the output fd before calling sendfile().<br></blockquote><div><br></div><div>ah, right. that makes more sense. yeah, i'll add this.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Rob<br>
</blockquote></div></div>