"apt" command line tool does not correctly check for terminal capabilities

Bug #1606270 reported by Clément
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The new-ish "apt" command draws its progress bar and produces escape codes regardless of advertised terminal capabilities; in particular, with TERM=dumb, "apt" still produces save_cursor and restore_cursor escape codes ("\0337" and "\0338"), in addition to colors and other ANSI escapes.

An example of a commonly used shell with TERM=dump is Emacs' shell buffers. In these, running "apt" produces the following:

```
(Reading database ... 363533 files and directories currently installed.)
Removing wireshark (2.0.2+ga16e22e-1) ...
7Progress: [ 0%] [...............................................................................................] 87Progress: [ 25%] [########################.......................................................................] 87Progress: [ 50%] [################################################...............................................] 87Progress: [ 75%] [########################################################################.......................] 8
78
```

This is due in part to the PackageManagerFancy::DrawStatusLine() function in apt-pkg/install-progress.cc.

Note that Emacs can process and display typical SGR ANSI escapes (in the form [<number>m; but not the more complex cursor manipulation commands.

```
$ apt policy apt
apt:
  Installed: 1.2.12~ubuntu16.04.1
  Candidate: 1.2.12~ubuntu16.04.1
  Version table:
 *** 1.2.12~ubuntu16.04.1 500
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.2.10ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
```

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

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

Changed in apt (Ubuntu):
status: New → Confirmed
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.