Skip to content

Improve globbing "unmatched brace" error message #2763

Closed
@danielshahaf

Description

@danielshahaf

I did this

% curl -d '{ "hello world": null }' http://example.com/{foo
curl: (3) [globbing] unmatched brace in column 20

I thought the error message was referring to the argument to -d and spent a while scratching my had trying to figure out why the first l of null would be reported as the location of the error. (In this instance it may be obvious, but this is a reduced example of a long command line.)

I expected the following

I suggest that the error message be clarified. For example:

  • Change "column" to "character"

  • Include the failing argument in the error message:

      curl: (3) [globbing] unmatched brace at character 20 of «http://example.com/{foo»
    
  • Include part of argument in the error message, e.g.,

      unmatched brace at character 20 (near ".com/{foo")
    

    This is inspired by perl's parser's error reporting:

      % perl -e '}'
      ⋮
      syntax error at -e line 1, near "}"
      ⋮
    

curl/libcurl version

curl 7.60.0 (x86_64-pc-linux-gnu) libcurl/7.60.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.4 libpsl/0.20.2 (+libidn2/2.0.4) libssh2/1.8.0 nghttp2/1.32.0 librtmp/2.3
Release-Date: 2018-05-16
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

(installed via the OS's package manager)

operating system

Debian unstable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions