Skip to content

Conversation

@simeonschaub
Copy link
Member

`\\` currently throws an error because it is parsed as @cmd "\\"
due to escaping in the parser and shell_parse therefore thinks it's a
dangling backslash.

@simeonschaub simeonschaub added bugfix This change fixes an existing bug cmd Relates to calling of external programs labels Jun 1, 2021
@simeonschaub simeonschaub added backport 1.6 Change should be backported to release-1.6 backport 1.7 labels Jun 9, 2021
@KristofferC KristofferC mentioned this pull request Jun 10, 2021
45 tasks
@KristofferC KristofferC mentioned this pull request Jun 17, 2021
20 tasks
@simeonschaub simeonschaub requested a review from vtjnash June 22, 2021 15:29
@simeonschaub
Copy link
Member Author

Bumping this again.

`` `\\` `` currently throws an error because it is parsed as `@cmd "\\"`
due to escaping in the parser and `shell_parse` therefore thinks it's a
dangling backslash.
@vtjnash vtjnash force-pushed the sds/unesc_backslash_cmd branch from 407f798 to 0662f62 Compare November 1, 2023 22:04
@vtjnash
Copy link
Member

vtjnash commented Nov 1, 2023

I tried finishing this PR, but Pkg currently relies on the existing behavior in one place:

   8 function gen_build_code(build_file::String; inherit_project::Bool = false)
   7     code = """                                    
   6         $(Base.load_path_setup_code(false))                     
   5         cd($(repr(dirname(build_file))))
   4         include($(repr(build_file)))                     
   3         """                            
   2     return ```
   1         $(Base.julia_cmd()) -O0 --color=no --history-file=no
1032         $(inherit_project ? `--project=$(Base.active_project())` : ``)
   1         --eval $code
   2         ```
   3 end                                                            

The trouble being that macro cmd can't precisely reverse the transform (as this PR desires to do), since the user might have called it with ``` syntax, which allowed the user to embed ` without escaping them, which otherwise (with single ` syntax) is a reversible transform

vtjnash pushed a commit that referenced this pull request Nov 2, 2023
Similar to how `escape_raw_string` enabled users to reverse the
transform done by string literals, this enables users to reverse the
transform done by cmd literals by specifying an argument of a '\`'.

Refs #41041
vtjnash added a commit that referenced this pull request Nov 4, 2023
Similar to how `escape_raw_string` enabled users to reverse the
transform done by string literals, this enables users to reverse the
transform done by cmd literals by specifying an argument of a '\`'.

Refs #41041

Co-authored-by: Simeon Schaub <[email protected]>
@simeonschaub
Copy link
Member Author

Superseded by #52001

@DilumAluthge DilumAluthge deleted the sds/unesc_backslash_cmd branch January 12, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.6 Change should be backported to release-1.6 bugfix This change fixes an existing bug cmd Relates to calling of external programs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants