[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt-get aborts in subshell with redirections on Debian 12



Thanks for the ideas!

On 25/09/2023 09:36, Greg Wooledge wrote:
On Mon, Sep 25, 2023 at 09:10:28AM +0900, John Crawley wrote:
I just tried, and yes it runs OK when the commands are in a script.
But type directly into the terminal:

errors=$(sudo apt-get install mirage 2>&1 1>/dev/tty)

To see the immediate abort.
(But not on Debian 11, or after invoking 'sh'.)

I actually tested in a terminal, not with a script.  But the fact that
*you* are getting different results with a script vs. a terminal is a
clue.  It doesn't give us a complete answer, but it's definitely a
significant observation.

The first thing you'll want to check is "type sudo", in your shell.

unicorn:~$ type sudo
sudo is hashed (/usr/bin/sudo)

sudo is hashed (/usr/bin/sudo)

If that doesn't give any further clues, you might look for unusual
configuration in your interactive shell.  Things like a DEBUG trap,
or the PROMPT_COMMAND or PS0 variables, which might trigger surprises
when running commands, would be good to know about.

I don't think I've added anything like that - this is a fairly new test install.
I tried logging into a Ctrl+Alt+F2 tty and got the same results.
For a moment I thought it might be because it's a Qemu VM, so dragged out my old test laptop and the results are the same.

The only thing I can think of right now is that this (VM and laptop both) is an i386 system. Could it be bash is missing some 32 bit update?

Anyway, I tried these:

1) Run "bash --noprofile --norc" to get a vanilla shell, without any
    aliases, functions, weird shopts, etc.  See if you still get the
    undesired results.

Same undesired result.

2) Try in dash, ksh, zsh or whatever other shells you have.  See if you
    get the undesired results in any shell other than bash.  (It looks
    like you already tried in dash, assuming sh -> dash.)

Dash is OK. I installed and tried ksh and zsh and there was no problem there either.

3) Create a new user account with only the default dotfiles, and see
    if you get the undesired results there.  (You may have to add it to
    the sudo group.)

adduser tmp
adduser tmp sudo

Log in to tmp (no graphical session set up), and the results are the same: behaviour in a bash shell is wrong, everything else works.

So the 32bit system is different??

--
John


Reply to: