Force COLUMNS > 0 for bug #394091.
authorZac Medico <zmedico@gentoo.org>
Tue, 20 Dec 2011 07:24:38 +0000 (23:24 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 20 Dec 2011 07:24:38 +0000 (23:24 -0800)
pym/portage/package/ebuild/doebuild.py

index 37aead0f37e21ac5d60f1d0806ca2a78d1164f0d..3c0d023d417d714b9f075db378d4ad11f55159b4 100644 (file)
@@ -313,6 +313,10 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
                columns = os.environ.get("COLUMNS")
                if columns is None:
                        rows, columns = portage.output.get_term_size()
+                       if columns < 1:
+                               # Force a sane value for COLUMNS, so that tools
+                               # like ls don't complain (see bug #394091).
+                               columns = 80
                        columns = str(columns)
                        os.environ["COLUMNS"] = columns
                mysettings["COLUMNS"] = columns