Public bug reported: 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 7[0;30r8[1A[J ``` 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 ``` ** Affects: apt (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to apt in Ubuntu. https://bugs.launchpad.net/bugs/1606270 Title: "apt" command line tool does not correctly check for terminal capabilities Status in apt package in Ubuntu: New 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 7[0;30r8[1A[J ``` 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 ``` To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1606270/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp