Skip to content

Conversation

@kyegupov
Copy link

@kyegupov kyegupov commented Nov 30, 2025

Closes #43847

The problem is the quote fix #42734 was:

Release Notes:

  • use consistent quoting for test name regexes in Go commands
  • ensure the quoting is correctly reverted when generating Delve DAP commands
@cla-bot
Copy link

cla-bot bot commented Nov 30, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-industries-bot
Copy link

zed-industries-bot commented Nov 30, 2025

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes: - Added/Fixed/Improved ... 

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes: - N/A 

Generated by 🚫 dangerJS against 855fa61

@kyegupov kyegupov force-pushed the kyegupov/fix-delve-subtests branch from 36e8c3c to 855fa61 Compare November 30, 2025 21:25
@cla-bot
Copy link

cla-bot bot commented Nov 30, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@kyegupov
Copy link
Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Nov 30, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @kyegupov on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Nov 30, 2025

The cla-bot has been summoned, and re-checked this pull request!

@kyegupov
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 30, 2025
@cla-bot
Copy link

cla-bot bot commented Nov 30, 2025

The cla-bot has been summoned, and re-checked this pull request!

Comment on lines +431 to +461
// Finish the old single-quoted sequence, add "\'", start a new single-quoted sequence
const SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING: &str = "'\\''";

/// Quotes an argument (e.g. a test name) for use in a shell command.
/// Using the single-quote technique described in https://stackoverflow.com/a/20053121:
/// `It's a "string"` => `'It'\''s a "string"'`
pub fn quote_arg(name: &str) -> String {
let mut quoted = "'".to_string();
for c in name.chars() {
if c == '\'' {
quoted.push_str(SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING);
} else {
quoted.push(c);
}
}
quoted.push('\'');
quoted
}

/// Unquotes an argument previously quoted via `quote_arg`.
pub fn unquote_arg(name: &str) -> String {
if name.starts_with('\'') && name.ends_with('\'') {
return name[1..name.len() - 1].replace(SINGLE_QUOTE_QUOTED_IN_SINGLE_QUOTED_STRING, "'");
}
// If this condition above not true, it's suspicious, since this function should be called only
// on strings that are known to be quoted.
// However, it should be safe to fall back to the original string (the result of this function
// is supposed to be "unsafe" for raw shell usage anyway).
name.to_string()
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is expecting unix shell escape characters and doesn't handle any shells for Window's. Could you make this non OS specific please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

3 participants