Tab completion warnings with ubuntu-bug when using alias for ls

Bug #1850804 reported by Alistair Cunningham
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Apport
In Progress
Undecided
Unassigned
apport (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

When running ubuntu-bug on the command line, and tab completing the package name, the following warnings are printed:

/usr/share/apport/symptoms/dist-upgrade.py: No such file or directory
grep: /usr/share/apport/symptoms/release-upgrade.py: No such file or directory

This happens when following alias is set:

alias ls='ls -N --color=yes --time-style=long-iso'

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: apport 2.20.11-0ubuntu8.1
ProcVersionSignature: Ubuntu 5.3.0-19.20-generic 5.3.1
Uname: Linux 5.3.0-19-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportLog:

ApportVersion: 2.20.11-0ubuntu8.1
Architecture: amd64
CurrentDesktop: Unity:Unity7:ubuntu
Date: Thu Oct 31 10:54:43 2019
InstallationDate: Installed on 2017-08-16 (805 days ago)
InstallationMedia: Ubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
PackageArchitecture: all
SourcePackage: apport
UpgradeStatus: Upgraded to eoan on 2019-10-04 (26 days ago)

Revision history for this message
Alistair Cunningham (acunningham) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, the issue doesn't seem to happen on a new 19.10 installation though.
The file listed is part of apport-symptoms which should be installed by default, but even without it the tab completion works

Changed in apport (Ubuntu):
importance: Undecided → Low
Revision history for this message
Alistair Cunningham (acunningham) wrote :

apport-symptoms is installed, but this keeps happening:

# dpkg -l apport-symptoms
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-============-============-=================================
ii apport-symptoms 0.22 all symptom scripts for apport

Revision history for this message
Sebastien Bacher (seb128) wrote :

Weird, what's the output of
- ls -l /usr/share/apport/symptoms/dist-upgrade.py
(it should be part of the binary)

Revision history for this message
Alistair Cunningham (acunningham) wrote :

# ls -l /usr/share/apport/symptoms/dist-upgrade.py
lrwxrwxrwx 1 root root 26 May 17 16:32 /usr/share/apport/symptoms/dist-upgrade.py -> ubuntu-release-upgrader.py

Revision history for this message
Sebastien Bacher (seb128) wrote :

What about
-ls -l /usr/share/apport/symptoms/ubuntu-release-upgrader.py
-dpkg -S /usr/share/apport/symptoms/ubuntu-release-upgrader.py
-debsums apport-symptoms

The file should be there...

Revision history for this message
Alistair Cunningham (acunningham) wrote :

# ls -l /usr/share/apport/symptoms/ubuntu-release-upgrader.py
-rw-r--r-- 1 root root 214 May 17 16:32 /usr/share/apport/symptoms/ubuntu-release-upgrader.py

# dpkg -S /usr/share/apport/symptoms/ubuntu-release-upgrader.py
apport-symptoms: /usr/share/apport/symptoms/ubuntu-release-upgrader.py

# debsums apport-symptoms
/usr/share/apport/symptoms/_audio_checks.py OK
/usr/share/apport/symptoms/_audio_data.py OK
/usr/share/apport/symptoms/_audio_mixercontrol.py OK
/usr/share/apport/symptoms/audio.py OK
/usr/share/apport/symptoms/display.py OK
/usr/share/apport/symptoms/security.py OK
/usr/share/apport/symptoms/storage.py OK
/usr/share/apport/symptoms/ubuntu-release-upgrader.py OK
/usr/share/doc/apport-symptoms/changelog.gz OK
/usr/share/doc/apport-symptoms/copyright OK

Revision history for this message
Sebastien Bacher (seb128) wrote :

Can you sudo apt install --reinstall apport-symptoms and see if that fixes the issue?

Revision history for this message
Alistair Cunningham (acunningham) wrote :

Still the same, unfortunately.

Revision history for this message
Alistair Cunningham (acunningham) wrote :

This also happens on 20.04. It now gives:

/usr/share/apport/symptoms/dist-upgrade.py: No such file or directory
grep: /usr/share/apport/symptoms/installation.py: No such file or directory
grep: /usr/share/apport/symptoms/release-upgrade.py: No such file or directory

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apport (Ubuntu):
status: New → Confirmed
Revision history for this message
Maksim S (max-svo) wrote :

ubuntu-bug actually greps output of ls
I have an alias for ls: ls -la
I can see output like this:
grep: /usr/share/apport/symptoms/-rw-r--r--: No such file or directory
grep: /usr/share/apport/symptoms/1: No such file or directory
grep: /usr/share/apport/symptoms/root: No such file or directory
grep: /usr/share/apport/symptoms/root: No such file or directory

I may be wrong but I think at the very least ubuntu-bug should call /usr/bin/ls and not just ls
Depending on user preferences, ubuntu-bug may even execute random software!

Changed in apport (Ubuntu):
milestone: none → ubuntu-20.07
Revision history for this message
Alistair Cunningham (acunningham) wrote :

This still happens after upgrading to Ubuntu 20.10:

grep: /usr/share/apport/symptoms/dist-upgrade.py: No such file or directory
grep: /usr/share/apport/symptoms/installation.py: No such file or directory
grep: /usr/share/apport/symptoms/release-upgrade.py: No such file or directory
qgrep: /usr/share/apport/symptoms/dist-upgrade.py: No such file or directory
grep: /usr/share/apport/symptoms/installation.py: No such file or directory
grep: /usr/share/apport/symptoms/release-upgrade.py: No such file or directory

Note that that I have the following alias set for ls:

alias ls='ls -N --color=yes --time-style=long-iso'

Revision history for this message
Alistair Cunningham (acunningham) wrote :

This still happens after upgrading to Ubuntu 21.10. Is there any news on fixing it?

Revision history for this message
Alistair Cunningham (acunningham) wrote :

Is there any news on this? The problem still happens after upgrading to Ubuntu 22.04. There don't appear to have been updates since I last reported this for 21.10.

Revision history for this message
Alistair Cunningham (acunningham) wrote :

This is still happening after upgrading to 23.10.

Revision history for this message
Benjamin Drung (bdrung) wrote :

I can confirm the behavior by setting the ls alias. Unsetting the alias will solve the issue. So apport should be made more robust against the alias.

Changed in apport (Ubuntu):
status: Confirmed → Triaged
description: updated
tags: added: lunar
summary: - Tab completion warnings with ubuntu-bug
+ Tab completion warnings with ubuntu-bug when using alias for ls
Benjamin Drung (bdrung)
Changed in apport:
milestone: none → 2.28.0
Revision history for this message
Benjamin Drung (bdrung) wrote :

Fix for it: https://github.com/canonical/apport/pull/222

You can apply the fix manually be editing /usr/share/bash-completion/completions/apport-bug and changing the function to:

_apport_symptoms ()
{
    local filename path symptoms
    for path in /usr/share/apport/symptoms/*; do
        [[ -e "$path" ]] || continue
        filename="${path##*/}"
        # hide utility files and symptoms that don't have a run() function
        [[ ! "$filename" =~ ^_.* ]] || continue
        grep -Eq "^def run\s*\(.*\):" "$path" || continue
        symptoms+=("${filename%.py}")
    done
    echo "${symptoms[*]}"
}

Changed in apport:
status: New → In Progress
Changed in apport (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.27.0-0ubuntu3

---------------
apport (2.27.0-0ubuntu3) mantic; urgency=medium

  * fix: raise "gdb not found" as soon as detected (LP: #2031919)
  * bash-completion: Do not use ls in completion (LP: #1850804)

 -- Benjamin Drung <email address hidden> Fri, 29 Sep 2023 01:03:44 +0200

Changed in apport (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.