Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Background sudo leaves terminal settings in raw-ish state after suspend/resume

Aperta
#552 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c, linux

Direzione di ricerca

Start by tracing how sudo's use_pty handling saves and restores terminal settings when a background command is suspended and resumed; the report identifies this path but names no source files or tests. Reproduce with the supplied bash script on Linux Mint with use_pty enabled, then inspect the relevant terminal and job-control code. Done means the terminal settings are sane after resuming with fg, including when the command's standard streams are redirected.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

To reproduce:
  1. Run the following test script (which runs a background sudo process) in bash with active job control:

test.sh:

#!/bin/bash
sudo -v         #ask for password if needed, so prompt doesn't interfere with the following

sudo bash -c "sleep 10" &     #start sudo background process

sleep 1
stty        #show terminal settings
echo "press ctrl-Z to suspend"

sleep 2
stty

sleep 2
stty sane       #restore terminal settings

  1. When prompted, suspend by pressing Ctrl-Z within 2 seconds

  2. Resume with fg.

Expected results:

After resume, sudo should leave the controlling terminal in a sane state.
stty output should be roughly speed 38400 baud; line = 0;, as before suspending.

Observed results:

Output is as follows. Terminal settings after resuming are similar to raw mode, and output formatting is garbled because of this:

Image

Notably, this also happens when stdin,stdout and stderr of the sudo process are all redirected (unlike the example above). sudo nevertheless seems to interfere with the controlling terminal.

sudo version / configuration:
sudo -V
Sudo version 1.9.15p5
Sudoers policy plugin version 1.9.15p5
Sudoers file grammar version 50
Sudoers I/O plugin version 1.9.15p5
Sudoers audit plugin version 1.9.15p5

Linux mint 22.3

/etc/sudo.conf: everything commented out (Linux Mint default)

/etc/sudoers: Linux Mint default, use_pty is set
sudoers.txt

Thanks for your consideration!

Lingua principale
C
Stelle
1.7k
Fork
306
Merge medio
1g 2h
PR unite (30g)
22

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sudo-project/sudo

Tutte le issue di sudo-project/sudo

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.