mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andrei Vagin <avagin@virtuozzo.com>
To: musl@lists.openwall.com, Laurent Bercot <ska-dietlibc@skarnet.org>
Cc: alpine-devel@lists.alpinelinux.org
Subject: Re: [PATCH] scanf: handle the L modifier for integers
Date: Thu, 31 May 2018 12:00:22 -0700	[thread overview]
Message-ID: <20180531190021.GA9758@outlook.office365.com> (raw)
In-Reply-To: <20180531064719.6805-1-avagin@virtuozzo.com>

>>Without this patch, ret will be 1 and mask will be 0. It is obviously
>>incorrect. According to the man page, L should work like ll:
>>
>>L Indicates that the conversion will be either e, f, or g and the
>>   next pointer is a pointer to long double or the conversion will
>>   be d, i, o, u, or x and the next pointer is a pointer to long
>>   long.
>
>  This is a GNU extension. POSIX states that L is only valid before
>a floating-point conversion specifier:
>
>L
>     Specifies that a following a, A, e, E, f, F, g, or G conversion 
>specifier
>     applies to an argument with type pointer to long double.
>
>  from 
>http://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html
>
>  So, it is valid for musl not to accept %Lx.
>  Now, the argument that it's a good idea to align musl's behaviour to
>glibc's whenever possible is a sensible one. But it's a decision for
>the musl authors to make, and the pros and cons need to be carefully
>balanced; musl's current behaviour is not _incorrect_.

It is incorrect, because scanf() has to return 0, or it has to handle the
L modifier. Currently it doesn't handle L and return 1, so the
application can't detect this issue.

I would prefer a case when musl works like glibc, if there are not any
reason to not to do that. For example,  now Alpine Linux is very popular
and there are a lot of packages. In many cases, a maintainer, who adds a
new package, fixes compile-time errors and doesn't run any tests.
A target application can work differently with musl comparing with glibc
due to this sort of issues.


  parent reply	other threads:[~2018-05-31 19:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31  6:47 Andrei Vagin
2018-05-31 14:20 ` Laurent Bercot
2018-05-31 19:00 ` Andrei Vagin [this message]
2018-05-31 20:44   ` Natanael Copa
2018-05-31 21:21     ` Andrei Vagin
2018-05-31 23:44     ` Rich Felker
2018-06-01  0:30       ` Szabolcs Nagy
2018-06-01  0:59         ` Rich Felker
2018-06-01  7:36       ` Andrei Vagin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180531190021.GA9758@outlook.office365.com \
    --to=avagin@virtuozzo.com \
    --cc=alpine-devel@lists.alpinelinux.org \
    --cc=musl@lists.openwall.com \
    --cc=ska-dietlibc@skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).