Re: [PATCH] ash: avoid GLIBC'ism %m

2017-07-22 Thread Kang-Che Sung
On Sun, Jul 23, 2017 at 10:03 AM, Kang-Che Sung  wrote:
>
> How about wrapping the printf("%m") uses within the __GNU_LIBRARY__ macro?
> It seems that %m support has been there from the beginning of glibc.

Correction. It's since glibc 1.06.

I've looked in the old ChangeLog entries and saw this:

Tue Oct 20 18:36:40 1992  Roland McGrath  (rol...@geech.gnu.ai.mit.edu)
* configure: Write error message and lose for option with missing arg.
* stdio/__vfscanf.c: Add `a' modifier, which makes %s and %[ fill
in a char ** with a malloc'd string.
(STRING_ADD_CHAR, STRING_ARG): New macros to deal with this hair.
(%s, %[): Use them.
* posix/gnu/types.h [__GNUC__] (__fsid_t): Define as long long.
* stdio/vfprintf.c: Add %m, which is %s of strerror (errno).

So... the check would be probably like this:
#if __GNU_LIBRARY__ > 1
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] ash: avoid GLIBC'ism %m

2017-07-22 Thread Kang-Che Sung
On Sun, Jul 23, 2017 at 4:33 AM, Michael Conrad  wrote:
> On 7/22/2017 2:56 PM, Johannes Schindelin wrote:
>>
>> No, not every libc. I would not have spent the time and effort to develop
>> the patch, contribute it, rework it and contribute a second iteration if
>> it was not for a good reason now, would I.
>>
>
> I believe his point is that your patch adds size to busybox which is
> unneeded for most users.  (btw, it's recommended to post bloatcheck numbers
> with a patch.  If you show a small number from bloatcheck then there is less
> to argue about)
>
> Which libc are you using?  Do you think %m support could be checked with an
> ifdef?
>

How about wrapping the printf("%m") uses within the __GNU_LIBRARY__ macro?
It seems that %m support has been there from the beginning of glibc.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] ash: avoid GLIBC'ism %m

2017-07-22 Thread Michael Conrad

On 7/22/2017 2:56 PM, Johannes Schindelin wrote:

Hi Denys,

On Fri, 21 Jul 2017, Denys Vlasenko wrote:


On Wed, Jul 19, 2017 at 3:47 AM, Jody Bruchon  wrote:

On 2017-07-18 9:15 PM, Kang-Che Sung wrote:

On Wed, Jul 19, 2017 at 2:11 AM, Markus Gothe 
wrote:

Actually last time I checked ‘%m’ is POSIX contrary to glibc’s deprecated
'%a’. However, I agree that it should not be used since at least uClibc can
be built without support for it.

How come %m is POSIX when I didn't see any mention of it in this page?
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html

It does not appear to be part of POSIX or the Single UNIX Specification. The
glibc man page (as of 2016-12-12) even indicates that it is a glibc-specific
extension:

*m *(Glibc extension; supported by uClibc and musl.) Print output of
/strerror(errno)/. No argument is required.

This sounds like every libc has already conceded to implementing it.

Let's benefit from it then?

No, not every libc. I would not have spent the time and effort to develop
the patch, contribute it, rework it and contribute a second iteration if
it was not for a good reason now, would I.

Ciao,
Johannes



I believe his point is that your patch adds size to busybox which is 
unneeded for most users.  (btw, it's recommended to post bloatcheck 
numbers with a patch.  If you show a small number from bloatcheck then 
there is less to argue about)


Which libc are you using?  Do you think %m support could be checked with 
an ifdef?


-Mike
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Re: [PATCH] ash: avoid GLIBC'ism %m

2017-07-22 Thread Johannes Schindelin
Hi Denys,

On Fri, 21 Jul 2017, Denys Vlasenko wrote:

> On Wed, Jul 19, 2017 at 3:47 AM, Jody Bruchon  wrote:
> > On 2017-07-18 9:15 PM, Kang-Che Sung wrote:
> >>
> >> On Wed, Jul 19, 2017 at 2:11 AM, Markus Gothe 
> >> wrote:
> >>>
> >>> Actually last time I checked ‘%m’ is POSIX contrary to glibc’s deprecated
> >>> '%a’. However, I agree that it should not be used since at least uClibc 
> >>> can
> >>> be built without support for it.
> >>
> >> How come %m is POSIX when I didn't see any mention of it in this page?
> >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html
> >
> > It does not appear to be part of POSIX or the Single UNIX Specification. The
> > glibc man page (as of 2016-12-12) even indicates that it is a glibc-specific
> > extension:
> >
> > *m *(Glibc extension; supported by uClibc and musl.) Print output of
> > /strerror(errno)/. No argument is required.
> 
> This sounds like every libc has already conceded to implementing it.
> 
> Let's benefit from it then?

No, not every libc. I would not have spent the time and effort to develop
the patch, contribute it, rework it and contribute a second iteration if
it was not for a good reason now, would I.

Ciao,
Johannes___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox