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

Bug#1059873: glibc-doc-reference: 12.14.5 String Input Conversions: The ‘%[’ conversion requires 1 match



Hi,

On 2024-01-02 19:24, Christopher Yeleighton wrote:
> Package: glibc-doc-reference
> Version: 2.31-1
> Severity: normal
> 
> Dear Maintainer,
> 
> *** Reporter, please consider answering these questions, where appropriate ***
> 
>    * What led up to the situation?
> 
> I used %s conversion to print a string to a file
> and %7[^] conversion to scan it back.

%7[^] is not a valid format string. Quoting the manual, section 12.14.5:

  To read in characters that belong to an arbitrary set of your choice,
  use the ‘%[’ conversion. You specify the set between the ‘[’ character
  and a following ‘]’ character, using the same syntax used in regular
  expressions for explicit sets of characters. As special cases:

  - A literal ‘]’ character can be specified as the first character of the set.

[...]

  - If a caret character ‘^’ immediately follows the initial ‘[’, then
    the set of allowed input characters is everything except the
    characters listed.

In your case, you want to match up to 7 characters, but given there is
no character or list of characters after the caret, it's not clear what
you want to achieve. If you want to match everything but a ‘[’, you
should use %7[^]] .

Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net


Reply to: