xgsch2pcb breaks with spaces in filenames

Bug #726828 reported by Peter Clifton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gEDA
Fix Committed
Medium
Unassigned

Bug Description

When creating a project (in this case from a template), with a space in the project name, the template copied schematics to names which had a space in them. The resulting .gsch2pcb file was not suitably quoted, and the file-names were broken at the space.

Tags: xgsch2pcb
Revision history for this message
Peter Clifton (pcjc2) wrote :

This is also a gsch2pcb bug...

gsch2pcb stores the list of schematics as a space-separated list, and doesn't appear to support any form of escaping.

Since gsch2pcb launches gnetlist using g_spawn_command_line_sync () which processes the command-line from a string passed to it.. it seems possible that things might "just work" with judicious placement of "" quotes around schematic filenames.

Quoting the docs for that function:

On Windows, please note the implications of g_shell_parse_argv() parsing command_line. Parsing is done according to Unix shell rules, not Windows command interpreter rules. Space is a separator, and backslashes are special. Thus you cannot simply pass a command_line containing canonical Windows paths, like "c:\\program files\\app\\app.exe", as the backslashes will be eaten, and the space will act as a separator. You need to enclose such paths with single quotes, like "'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".

Changed in geda:
assignee: nobody → Krzysztof Kościuszkiewicz (k-kosciuszkiewicz)
Revision history for this message
Krzysztof Kościuszkiewicz (k-kosciuszkiewicz) wrote :

Proposed fix on gsch2pcb side:
* keep a GList of .sch files instead lumping them into a single string
* allow contents of schematics option to be quoted (use g_shell_parse_argv() for that)
* replace g_spawn_command_line_sync with a helper function allowing to eliminate shell interpretation of the command line

Patch set is attached.

Changed in geda:
status: Confirmed → In Progress
Revision history for this message
Peter Clifton (pcjc2) wrote :

Looks good to me.

I've not had time to review line-by-line, but I skimmed the patch series and it looks excellent. Unfortunately, I won't have time to test and commit just now - as I'm supposed to be working on something else. (Just checking my email at the moment).

It did occur to me (although I never tested it), that the spawn function currently in use with gsch2pcb actually passes through a shell expansion phase, so "" and \" quoting "might" have already worked - but that is very subtle and not at all obvious.

I think your patch series is superior in every way to what we had.

I REALLY want to see you get commit access so you can push changes directly (even if you still want to get them reviewed first). Please email me off list and we can see about making that happen.

Best wishes,

Revision history for this message
Krzysztof Kościuszkiewicz (k-kosciuszkiewicz) wrote :

I think the attached patch should be enough to have this fixed.
Windows filenames might have issues when using old project file with new code, but I saw more severe portability problems in the code right now... Also now all options are quoted when needed, but gsch2pcb only supports quoting in the schematics option.

Revision history for this message
Krzysztof Kościuszkiewicz (k-kosciuszkiewicz) wrote :
Changed in geda:
assignee: Krzysztof Kościuszkiewicz (k-kosciuszkiewicz) → nobody
status: In Progress → Fix Committed
Changed in geda:
status: Fix Committed → Fix Released
Revision history for this message
Vladimir Zhbanov (vzhbanov) wrote :

We apparently have to have a separate bug tracker for xgsch2pcb (or merge it into geda gaf :-))

Changed in geda:
status: Fix Released → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.