Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14511

Re: exec/read -s bug?

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Lars Schneider <larsxschneider@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: exec/read -s bug?
Date Sun, 19 Aug 2018 21:12:07 +0200
Lines 62
Approved bug-bash@gnu.org
Message-ID <mailman.5300.1534705937.1292.bug-bash@gnu.org> (permalink)
References <70D019FA-3393-404C-B689-20E499BC66B9@gmail.com> <2E73F4FF-7FCA-4648-8A30-0E3DC9320781@gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1534705938 1604 208.118.235.17 (19 Aug 2018 19:12:18 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=2UDtvJ6a0E0m8caaIAYYji+VmSJ2FA+US+MZ4tDtN/o=; b=bnP4xQaszlURCu04fOD5yJh5y1TFE2IY7hBh/2IlIl2U7FE8q2yw1GMFgq5ptw1hgf Rx6lR96PfZwOg9+hl6ClE2HMiDMwBqEcTgRHturzTkFHf/ZzEnQSBcmhT2Fkcn0ePBik gInTCsJMElTvO8Kry5wWaUnWwj0+E755R1Yp8cWgPnBZLGKDd0fbG3IkK8/RX3rYi0Bn MV2ZhPiHgCnt+lhfqfF33V97nrrSxLGmTpXK3xFbM03L1YZ/GCZQAbWz1cPw1XgUSEog LG8rANDPhNMeAwH8l/buJ/xklbqAQVg+EsFh9dnpGLAbEfxKgQkOMqsgiT95iZUEKt61 e1dA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=2UDtvJ6a0E0m8caaIAYYji+VmSJ2FA+US+MZ4tDtN/o=; b=ba/2/cedNAk6WQJnoT2YF9Sd+rfCKZY9SafNrjtCBv3y6YlJtQKno/M25YRwq5w2IR lCPhKI4lVZ8kQsHCuFZRoxWC7GfziX/dddIyWnGps2Te6ouphLmMPWUQNyI/4ByC0613 ZLtg3wSncMhc7+N9l+YNRATo2OvWWOIA1qT77/ZjK2QhQCBElOEdZ+S92CVo6bOiiq99 M9bKvLHW7VvJzPPErBjW9fIoa/6LVBy5d00FeBBmE/E5YFp0v4ZOnZWfFY6VS3VNN8E0 LS4uGlyo6keuM++2dnz5CSijx8DFHJKyDkFZ4cv6pcO7VwMVEbIgCWuBN3T/JKZtQLY+ V/Ow==
X-Gm-Message-State AOUpUlEpRHcGrBv1wfg1FHzWh1tXpAnCotllpPkDNKNE/dV75cfOKj6V JU1sQQ0hrDeXbI8BJDcv3exs8wEL
X-Google-Smtp-Source AA+uWPxA1IPKDnHR6ZuwuOltVqY8HVHhgQNbdRjZt4yw+G6Pq7Q6GbqdGupcLR0lgKX/I+97BuwG3g==
X-Received by 2002:a1c:8414:: with SMTP id g20-v6mr13589471wmd.90.1534705929312; Sun, 19 Aug 2018 12:12:09 -0700 (PDT)
In-Reply-To <2E73F4FF-7FCA-4648-8A30-0E3DC9320781@gmail.com>
X-Mailer Apple Mail (2.3445.9.1)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:400c:c09::244
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14511

Show key headers only | View raw


> On Aug 19, 2018, at 8:45 PM, Lars Schneider <larsxschneider@gmail.com> wrote:
> 
> 
>> On Aug 19, 2018, at 6:33 PM, Lars Schneider <larsxschneider@gmail.com> wrote:
>> 
>> Hi,
>> 
>> consider this script:
>> 
>> 	#!/bin/bash
>> 	[ "`whoami`" = "root" ] || {
>> 	  exec sudo -u root "$0" "$@"
>> 	}
>> 	read -s -p "enter stuff: " stuff
>> 
>> If I run the script as normal user (not root!) and I abort the "read -s -p"
>> call with "ctrl-c", then my shell is still in silent mode.
>> 
>> I can consitently replicate that behavior on Ubuntu 14.04.5 LTS (Trusty) 
>> and BASH 4.3.11(1)-release (x86_64-pc-linux-gnu) as well as BASH 4.3.30.
>> 
>> I also installed BASH 4.4.18 from source and I can replicate the issue.
> 
> I did a mistake: The problem _was_ fixed with BASH 4.4.18.
> Further testing revealed that it is fixed with 4.4. too but not in Bash-4.3 patch 46.
> 
> I think the following item in the release notes corresponds to the problem:
> 
> oo. Fixed a bug that caused bash to not clean up readline's state, including
>     the terminal settings, if it received a fatal signal while in a readline()
>     call (including `read -e' and `read -s').
> 
> Does anyone see a workaround to set the readline state properly
> for older BASH versions?

OK, I found a work around:

	[ "`whoami`" = "root" ] || {
	  exec sudo -u root "$0" "$@"
	}

	function finish {
	  stty echo echok
	}
	trap finish EXIT
	read -s -p "enter stuff: " stuff
	echo "answer: $stuff"

Cheers,
Lars

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: exec/read -s bug? Lars Schneider <larsxschneider@gmail.com> - 2018-08-19 21:12 +0200

csiph-web