This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/20339] New: wordexp(3) fails for (certain) names (with single quotes and spaces)


https://sourceware.org/bugzilla/show_bug.cgi?id=20339

            Bug ID: 20339
           Summary: wordexp(3) fails for (certain) names (with single
                    quotes and spaces)
           Product: glibc
           Version: 2.23
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: steffen at sdaoden dot eu
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

While testing my new tab-completion and shell quoting i came along testing with
the files (UTF-8):

  dräi    dr$'\' c\cAa x.txt'    drö'   öge'    drü' üe'

It doesn't seem to be possible to match the (unquoted) dr'..., i.e., to match
across the single quote:

  name="/tmp/dr\\'";
  fprintf(stderr, "GLOBBING <%s>\n",name);
  ..
  i = wordexp(name, &we, WRDE_NOCMD);
  ..
  switch(we.we_wordc){
  case 1:
    cp = savestr(we.we_wordv[0]);
    fprintf(stderr, "MATCH <%s>\n",cp);
    break;
  ..

This gives me:

  GLOBBING </tmp/dr\'>
  MATCH </tmp/dr'>

So it does find the one file that exists:

  ?0[steffen@wales tmp]$ ll dr\'*
  -rw------- 1 steffen steffen 0 Jul  6 14:47 'dr'\'' c'$'\001''a x.txt'

But it seems to cut off the name after the space.
(While here: the quoting os ls(1) is hard to grasp, right?)

This is on a current ArchLinux:

  ?0[steffen@wales tmp]? pacman -Q glibc
  glibc 2.23-5

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]