Opened 5 years ago

Last modified 3 weeks ago

#961 new defect

option quoting in csc is a complete mess

Reported by: felix Owned by:
Priority: major Milestone: 5.0
Component: core tools Version: 4.8.x
Keywords: Cc:
Estimated difficulty: hard

Description (last modified by felix)

Using things like csc -cflags in shell scripts is mostly unusable, as the quoted include path (-I" ... ") is taken verbatim and not recognized by gcc due to the quotes.

Even though this is fundamentally based on the completely useless and insane shell quoting rules of sh and it's bastards, the code in csc doesn't make it any better, by using various ways of quoting ("qs", "quotewrap", "quote-option") and a tangled labyrinth of variables and thoughtlessly written crap code.

csc needs a complete rewrite. Ideally with lots of stuff removed to makes it less complex (like deployment) and a single point where options are prepared shell and shell-quoted as necessary.

This will necessarily break lots of stuff. It doesn't matter. It has to be.

Change History (6)

comment:1 Changed 5 years ago by felix

  • Description modified (diff)

comment:2 Changed 4 years ago by sjamaan

Does the qs patch (58684f69572453acc6fed7326fa9df39be98760e) fix any of this?

comment:3 Changed 15 months ago by sjamaan

  • Estimated difficulty set to hard

comment:4 Changed 13 months ago by sjamaan

It doesn't, see #1334

comment:5 Changed 13 months ago by sjamaan

  • Milestone changed from someday to 5.0

You know, this would be a great one to tackle for CHICKEN 5, since the breakage won't matter.

comment:6 Changed 3 weeks ago by felix

I don't know what to do here. To avoid quoting hell, one should probably use execve and friends in this case, but the appropriate device for Windows does not exist. The quoting rules with cmd.exe are even more insane than under UNIX and make up a large part of the messy code that is used in csc to somehow pass the correct arguments to subprocesses.

A rewrite is certainly desirable, but not required for C5. We should identify specific functionality that is either broken or *must* be changed in an incompatible manner.

Note: See TracTickets for help on using tickets.