uutils / uutils/coreutils

[Compatibility BUG]. uutils tail breaks update-alternatives when run under pseudo

Open
#9,292 19 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

U - tail
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

If you use pseudo to build a distribution (as Yocto/OpenEmbedded does) any attempt to run update-alternatives as part of packaging will fail.
The failure is caused by the uutils tail command.

This script, run on Kubuntu 25.10 with pseudo installed, shows the problem:

#!/bin/sh
# Assumes that pseudo is installed in /usr/bin
# and that libpseudo.so is in /usr/lib/x86_64-linux-gnu/pseudo/
#

# Set up the environment
#
rm -rf testenv testnew
mkdir -p testenv/bin testenv/var/pseudo
ln -s /usr/bin/pseudo testenv/bin/pseudo

# Set the environment variables to run pseudo
#
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/pseudo/libpseudo.so
PSEUDO_PREFIX=`pwd`/testenv
export LD_PRELOAD PSEUDO_PREFIX

# Create a relevant update-alternatives file.
# (Without using uutyils cat, as thet produces:
#   couldn't allocate absolute path for 'null'.
# from pseudo....
#
(echo "/usr/bin/arch"
 echo "/bin/busybox.nosuid 50"
) > test-uaf

# This works, result is /bin/busybox.nosuid
#
echo "Running GNU tail"
result=`grep '50$' test-uaf | gnutail -n 1 | sed 's/ [^ ]*$//'`
echo "Result is: $result"
echo

# This fails, result is blank, and hence the resulting link is absent.
#
echo "Running uutils tail"
result=`grep '50$' test-uaf | tail -n 1 | sed 's/ [^ ]*$//'`
echo "Result is: $result"

The output from this is:

[gmllaptop]: ./test.sh 
Running GNU tail
Result is: /bin/busybox.nosuid

Running uutils tail
couldn't allocate absolute path for 'null'.
couldn't allocate absolute path for ''.
tail: cannot open 'standard input' for reading: No such file or directory
Result is: 

This might be related to https://github.com/uutils/coreutils/issues/9288

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the shell reproducer from the issue with pseudo installed and compare uutils tail against GNU tail. Trace the tail invocation under LD_PRELOAD and PSEUDO_PREFIX, then verify that the uutils command produces the same selected line and no pseudo path errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.