[Bug 2127080] [NEW] sudo-rs does not accept escaped characters in command-line arguments

Simon Johnsson 2127080 at bugs.launchpad.net
Wed Oct 8 12:27:01 UTC 2025


Public bug reported:

In rust-sudo-rs 0.2.8-1ubuntu4 a fix was introduced that allowed for '='
to be used in commands as such:

Cmd_Alias FOO_CMD = /bin/foo --bar=1

However, this fix also made the escaped equivalence generate an "illegal
escape sequence error":

Cmd_Alias BAR_CMD = /bin/foo --bar\=1

-------------------------------------

Steps to reproduce:

1. Create a file called "test" with the following content:

Cmd_Alias FOO_CMD = /bin/foo --bar=1
Cmd_Alias BAR_CMD = /bin/foo --bar\=1

2. Run visudo on the file:

$ visudo -c -f test

3. An error is given:

test:2:36: syntax error: illegal escape sequence
Cmd_Alias BAR_CMD = /bin/foo --bar\=1
                                   ^
visudo: invalid sudoers file

-------------------------------------

What I expect to happen:

The sudoers file is parsed correctly without an error.

Release: Ubunutu 25.10
sudo-rs version: 0.2.8-1ubuntu5

** Affects: rust-sudo-rs (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  In rust-sudo-rs 0.2.8-1ubuntu4 a fix was introduced that allowed for '='
  to be used in commands as such:
  
  Cmd_Alias FOO_CMD = /bin/foo --bar=1
  
  However, this fix also made the escaped equivalence generate an "illegal
  escape sequence error":
  
  Cmd_Alias BAR_CMD = /bin/foo --bar\=1
  
+ -------------------------------------
  
  Steps to reproduce:
  
  1. Create a file called "test" with the following content:
  
  Cmd_Alias FOO_CMD = /bin/foo --bar=1
  Cmd_Alias BAR_CMD = /bin/foo --bar\=1
  
  2. Run visudo on the file:
  
  $ visudo -c -f test
  
  3. An error is given:
  
  test:2:36: syntax error: illegal escape sequence
  Cmd_Alias BAR_CMD = /bin/foo --bar\=1
-                                    ^
+                                    ^
  visudo: invalid sudoers file
+ 
+ -------------------------------------
  
  What I expect to happen:
  
  The sudoers file is parsed correctly without an error.
  
- 
  Release: Ubunutu 25.10
  sudo-rs version: 0.2.8-1ubuntu5

** Bug watch added: github.com/trifectatechfoundation/sudo-rs/issues #1295
   https://github.com/trifectatechfoundation/sudo-rs/issues/1295

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-sudo-rs in Ubuntu.
https://bugs.launchpad.net/bugs/2127080

Title:
  sudo-rs does not accept escaped characters in command-line arguments

Status in rust-sudo-rs package in Ubuntu:
  New

Bug description:
  In rust-sudo-rs 0.2.8-1ubuntu4 a fix was introduced that allowed for
  '=' to be used in commands as such:

  Cmd_Alias FOO_CMD = /bin/foo --bar=1

  However, this fix also made the escaped equivalence generate an
  "illegal escape sequence error":

  Cmd_Alias BAR_CMD = /bin/foo --bar\=1

  -------------------------------------

  Steps to reproduce:

  1. Create a file called "test" with the following content:

  Cmd_Alias FOO_CMD = /bin/foo --bar=1
  Cmd_Alias BAR_CMD = /bin/foo --bar\=1

  2. Run visudo on the file:

  $ visudo -c -f test

  3. An error is given:

  test:2:36: syntax error: illegal escape sequence
  Cmd_Alias BAR_CMD = /bin/foo --bar\=1
                                     ^
  visudo: invalid sudoers file

  -------------------------------------

  What I expect to happen:

  The sudoers file is parsed correctly without an error.

  Release: Ubunutu 25.10
  sudo-rs version: 0.2.8-1ubuntu5

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-sudo-rs/+bug/2127080/+subscriptions




More information about the foundations-bugs mailing list