apt-get flushes read buffer

Bug #1261880 reported by Cliff Carson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Have a script that installs all the additional programs (chromium-browser, glabel, gimp,,,, etc) after installing the base 14.04 system. Have used this same script for many relase of Ubuntu. When I run it now it appears that the first call to apt-get will purge the read buffer on the script. Example of the script

while read cmdtodo prodtoinst
  do
    apt-get -y $cmdtodo $prodtoinst
done < $infile

The infile contains a list of commands and products

remove rythmbox
install glabel
install gimp
install gnucash

What I see at the terminal after calling the user install script is the output of apt-get remove rythmbox and then the rest of the lines in the infile (the "install glabel" "install gimp" etc get outputed to the terminal before the completion of the apt-get remove command. The installs stop.

If the user command is immediately re-run the first product fails because it is either installed or uninstalled and the next product is picked up and run. Again during the run the infile buffer is flushed to the terminal and the installs stop.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: apt 0.9.14.1ubuntu1
ProcVersionSignature: Ubuntu 3.12.0-7.15-generic 3.12.4
Uname: Linux 3.12.0-7-generic x86_64
ApportVersion: 2.12.7-0ubuntu2
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Dec 17 14:36:52 2013
InstallationDate: Installed on 2013-12-17 (0 days ago)
InstallationMedia: Ubuntu-GNOME 14.04 "Trusty Tahr" - Alpha amd64 (20131217)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: apt
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Cliff Carson (ccarson1) wrote :
Revision history for this message
Cliff Carson (ccarson1) wrote :

No activity on this bug report. Was wondering if it is valid to call apt-get within as scripts read file loop? I have changed the script to read the file into a local variable products and use a "for products in $productlist" to loop through the calls to "apt-get install $product".

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
Revision history for this message
Manuel (mhutter) wrote :

It appears the problem occurs after fetching the deb-files:

root@app:~# cat script.sh
apt-get install -yq mysql-server
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"

root@app:~# cat script.sh | bash
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  *snip*
Suggested packages:
  *snip*
The following NEW packages will be installed:
  l*snip*
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,026 kB of archives.
After this operation, 96.5 MB of additional disk space will be used.
Get:1 http://mirrors.digitalocean.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6,364 B]
*snip*
Get:12 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main mysql-server all 5.5.37-0ubuntu0.14.04.1 [12.5 kB]
Fetched 9,026 kB in 0s (26.4 MB/s)
Preconfiguring packages ...
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
echo "more stuff"
Selecting previously unselected package libaio1:amd64.
(Reading database ... 60805 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.5.37-0ubuntu0.14.04.1_all.deb ...
*snip*

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.