-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Windows path (\
instead of /
)
#108
Comments
\
instead of /
)
@tdurieux Hi, thank you for reporting this. From the top of my head, I think the reasoning there was that if you had an |
Good question, I did not see people using \ in a random location. I only saw it before a new line. I will investigate the \ usage in dockerfiles. ps: I am a researcher and I am analyzing a lot of dockerfiles and your lib is part of my stack, thanks a lot! |
From my quick investigation inside Below, you will find the number of occurrences of {
"\\\n": 897407,
"\\n": 31850,
"\\\"": 19864,
"\\ ": 47747,
"\\(": 3352,
"\\)": 3371,
"\\1": 2353,
"\\$": 4344,
"\\H": 66,
"\\m": 554,
"\\-": 1643,
"\\.": 3669,
"\\d": 1116,
"WINDOWS_PATH": 4974, // according to this regex /(?<ParentPath>(?:[a-zA-Z]\:|\\\\[\w\s\.]+\\[\w\s\.$]+)\\(?:[\w\s\.]+\\)*)(?<BaseName>[\w\s\.]*?)/gim
"\\/": 7606,
"\\;": 1067,
"\\F": 258,
"\\C": 477,
"\\S": 1232,
"\\s": 4284,
"\\c": 548,
"\\P": 701,
"\\o": 261,
"\\b": 1005,
"\\t": 1298,
"\\*": 496,
"\\&": 299,
"\\h": 137,
"\\l": 135,
"\\U": 73,
"\\{": 174,
"\\3": 14,
"\\2": 376,
"\\i": 355,
"\\j": 115,
"\\p": 392,
"\\K": 28,
"\\|": 276,
"\\}": 123,
"\\\t": 170,
"\\W": 511,
"\\M": 846,
"\\v": 470,
"\\T": 195,
"\\B": 191,
"\\N": 185,
"\\z": 87,
"\\J": 73,
"\\O": 41,
"\\A": 132,
"\\L": 64,
"\\g": 1449,
"\\u": 275,
"\\0": 348,
"\\r": 607,
"\\D": 217,
"\\'": 397,
"\\E": 87,
"\\w": 471,
"\\I": 118,
"\\`": 96,
"\\[": 738,
"\\]": 723,
"\\k": 15,
"\\+": 352,
"\\#": 168,
"\\a": 166,
"\\\r": 531,
"\\e": 317,
"\\?": 111,
"\\=": 174,
"\\_": 394,
"\\f": 25,
"\\V": 149,
"\\<": 46,
"\\:": 111,
"\\R": 318,
"\\^": 12,
"\\>": 76,
"\\G": 37,
"\\x": 240,
"\\@": 32,
"\\q": 41,
"\\~": 3,
"\\Q": 26,
"\\%": 106,
"\\!": 50,
"\\7": 30,
"\\4": 6,
"\\y": 7,
"\\Z": 1,
"\\”": 2,
"\\,": 3,
"\\5": 3,
"\\9": 1
} If windows paths are ignored, you can see that the number of matches with {
"\\\n": 896348,
"\\n": 30972,
"\\\"": 19585,
"\\ ": 47518,
"\\(": 3282,
"\\)": 3300,
"\\1": 2266,
"\\$": 3940,
"\\H": 6,
"\\m": 212,
"\\-": 1643,
"\\.": 3521,
"\\d": 319,
"WINDOWS_PATH": 4974,
"\\;": 968,
"\\s": 3413,
"\\c": 221,
"\\/": 6075,
"\\b": 256,
"\\&": 299,
"\\h": 71,
"\\l": 49,
"\\U": 20,
"\\{": 158,
"\\3": 14,
"\\2": 345,
"\\i": 44,
"\\j": 39,
"\\K": 28,
"\\*": 390,
"\\t": 767,
"\\|": 268,
"\\}": 118,
"\\\t": 170,
"\\p": 180,
"\\W": 247,
"\\M": 519,
"\\F": 152,
"\\v": 228,
"\\z": 80,
"\\J": 44,
"\\O": 21,
"\\P": 156,
"\\0": 294,
"\\r": 359,
"\\S": 585,
"\\w": 120,
"\\I": 81,
"\\`": 96,
"\\C": 168,
"\\+": 352,
"\\u": 100,
"\\#": 166,
"\\L": 15,
"\\\r": 384,
"\\e": 217,
"\\?": 97,
"\\=": 174,
"\\'": 274,
"\\[": 647,
"\\]": 631,
"\\<": 45,
"\\:": 111,
"\\_": 347,
"\\R": 56,
"\\^": 12,
"\\o": 19,
"\\V": 45,
"\\A": 52,
"\\g": 47,
"\\@": 30,
"\\D": 32,
"\\E": 50,
"\\q": 31,
"\\~": 3,
"\\>": 50,
"\\a": 48,
"\\%": 80,
"\\x": 222,
"\\N": 112,
"\\B": 99,
"\\T": 69,
"\\!": 49,
"\\G": 7,
"\\f": 11,
"\\k": 2,
"\\7": 7,
"\\4": 3,
"\\Q": 6,
"\\Z": 1,
"\\”": 2,
"\\,": 3,
"\\5": 1
} |
@tdurieux Thank you for your information and apologies for the delay in responding. I am hesitant to change the API. Would it be sufficient to provide you an API to just get the raw textual content of the arguments as a single string? Thus, given |
Hi @rcjsuen, I do think that you already provide this API 'getRawArguments'. I think my workaround would be to change the escape character for the commands that have paths as parameters. Did you see my PR? |
#107 is indeed unrelated to this issue. |
Hello,
I have an issue with windows paths such as
VOLUME C:\\data\\db C:\\data\\configdb
In this case, dockerfile-ast automatically removes the \ from the argument but I want to keep the \ in order to have a valid path. Is there a reason why the
\\
are removed from the arguments?I saw that the escaped character is ignored here: https://github.com/rcjsuen/dockerfile-ast/blob/master/src/instruction.ts#L296 is it intentional?
The text was updated successfully, but these errors were encountered: