[Bug 2123859] Re: sudo-rs does not accept a '=' in command definition

Stefan Hammer 2123859 at bugs.launchpad.net
Tue Oct 7 16:00:56 UTC 2025


This change introduces new type of failure. sudo.ws allows escaping '='
(in fact, the manual indicates that you must), but now with this patch,
if you use the old escaped syntax, sudo-rs will throw an error for
"illegal escape sequence".

on Jammy

$ cat test << EOF
Cmd_Alias FOO_CMD = /bin/foo --bar=1
Cmd_Alias BAR_CMD = /bin/foo --bar\=1
EOF

$ visudo -c -f test
Warning: test:2:11: unused Cmnd_Alias "BAR_CMD"
Warning: test:1:11: unused Cmnd_Alias "FOO_CMD"
test: parsed OK

-- 
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/2123859

Title:
  sudo-rs does not accept a '=' in command definition

Status in rust-sudo-rs package in Ubuntu:
  Fix Released

Bug description:
  sudo-rs does not accept a '=' in command definition or alias, like
  `Cmd_Alias FOO_CMD = /bin/foo --bar=1`, but regular sudo accept it.

  IMHO sudo-rs should accept '=' characters like sudo.ws does.

  Steps to reproduce :

  1. Create a sample sudoers file with a command including a '='
  character

  $ cat /tmp/sudoers << EOF
  Cmd_Alias FOO_CMD = /bin/foo --bar=1
  %staff ALL = (root) NOPASSWD: FOO_CMD
  %users ALL = (root) NOPASSWD: /bin/foo --bar=2
  EOF

  2. Test the file with regular sudo

  $ visudo.ws -c -f /tmp/sudoers
  /tmp/sudoers: parsed OK

  3. Test the file with sudo-rs

  $ visudo-rs -c -f /tmp/sudoers
  /tmp/sudoers:1:35: syntax error: garbage at end of line
  Cmd_Alias FOO_CMD = /bin/foo --bar=1
                                    ^
  /tmp/sudoers:3:45: syntax error: garbage at end of line
  %users ALL = (root) NOPASSWD: /bin/foo --bar=2
                                              ^
  visudo: invalid sudoers file

  Tested on Ubuntu 25.10 with sudo-rs version 0.2.8-1ubuntu2

   lsb_release -rd
  Description:	Ubuntu Questing Quokka (development branch)
  Release:	25.10

  $ apt-cache policy sudo sudo-rs
  sudo:
    Installed: 1.9.16p2-3ubuntu2
    Candidate: 1.9.16p2-3ubuntu2
    Version table:
   *** 1.9.16p2-3ubuntu2 500
          500 http://archive.ubuntu.com/ubuntu questing/main amd64 Packages
          100 /var/lib/dpkg/status
  sudo-rs:
    Installed: 0.2.8-1ubuntu2
    Candidate: 0.2.8-1ubuntu2
    Version table:
   *** 0.2.8-1ubuntu2 500
          500 http://archive.ubuntu.com/ubuntu questing/main amd64 Packages
          100 /var/lib/dpkg/status

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




More information about the foundations-bugs mailing list