Opened 14 years ago

Last modified 2 years ago

#25823 new defect

muniversal fails when filename contains chars special to the shell, like parens

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: portgroup Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), cooljeanius (Eric Gallager)
Port:

Description

Installing cairo-devel @1.9.14_0+universal fails because it installs a file whose name contains parentheses and muniversal doesn't properly escape filenames when running shell programs.

[snip]
DEBUG: universal: merge: merging /opt/local/share/gtk-doc/html/cairo/cairo-Quartz-(CGFont)-Fonts.html from /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_cairo-devel/work/destroot-i386 and /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_cairo-devel/work/destroot-x86_64
sh: -c: line 0: syntax error near unexpected token `('
[snip]

Change History (12)

comment:1 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

In r70019 I simply enclosed filenames in quotes when passing them to shell programs. But this means now muniversal will fail for files whose names contain quotes. There must be some procedure that we can call that properly escapes all characters...

comment:2 Changed 14 years ago by jmroot (Joshua Root)

What's wrong with using single quotes?

comment:3 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Doesn't that then break any files whose names contain single quotes?

comment:4 Changed 14 years ago by danielluke (Daniel J. Luke)

Maybe switch to exec instead of system?

comment:5 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

I've wondered about that before. Why do we ever use system anywhere, and don't just use exec all the time, since it has this built-in escaping property, plus the ability to return the output?

comment:6 Changed 14 years ago by danielluke (Daniel J. Luke)

I would guess it's mostly people don't know exec exists, or don't think about the problems that system makes you deal with, or start out quickly testing something with system and when it works don't think about making it work better ...

comment:7 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Is there anything at all that system is better at? If not, perhaps we should deprecate and eventually remove it, like we did already with cd and exit.

comment:8 Changed 14 years ago by danielluke (Daniel J. Luke)

I think system doesn't redirect the command's STDOUT (so you could potentially see the progress as the command is being run) and since it does shell expansion and returns the return code of the program it might be easier to use in some situations.

I can't really think of a reason to use it over exec, though - but I'm not really a tcl expert of any kind.

comment:9 Changed 14 years ago by jmroot (Joshua Root)

There would be no build output in the logs if we used exec for everything. Probably you want to string map " to \" in addition to enclosing in double quotes.

comment:10 in reply to:  1 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

In r70019 I simply enclosed filenames in quotes when passing them to shell programs.

I also enclosed the diffFormat argument in quotes, which was an error and caused #25991.

comment:11 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:12 Changed 2 years ago by mascguy (Christopher Nielsen)

Keywords: portgroup added

Add keyword portgroup, to pg-related tickets

Note: See TracTickets for help on using tickets.