Bug 84532 - [xorg-xinit] startx breaks if GREP_OPTIONS changes output format
Summary: [xorg-xinit] startx breaks if GREP_OPTIONS changes output format
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xinit (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-30 21:25 UTC by Cem Aydin
Modified: 2018-08-10 20:30 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Cem Aydin 2014-09-30 21:25:33 UTC
This was reported on the Arch Linux bugtracker but it's an upstream issue, so I'm reporting it here.

I think appeared by the xinit git tag xinit-1.3.4 .
I think would've been introduced by commit http://cgit.freedesktop.org/xorg/app/xinit/commit/?id=44915d6953076849b69a017f6fc8234b0f254362 .

---
https://projects.archlinux.org/svntogit/packages.git/tree/trunk/git-upstream-fixes.patch?h=packages/xorg-xinit#n378

+ tty_num=$(echo "$tty" | grep -oE '[0-9]+$')

If GREP_OPTIONS has color=always set, then this uses coloured grep output, meaning $tty_num carries colour information in `vtarg="vt$tty_num"`.

To resolve:

- tty_num=$(echo "$tty" | grep -oE '[0-9]+$')
+ tty_num=$(echo "$tty" | grep --color=never -oE '[0-9]+$')
---

Some people reported a problem on the Arch Linux Forum: https://bbs.archlinux.org/viewtopic.php?id=186382

While it's not yet entirely sure that it's due to this issue I think it may well be.

An error that was posted there contains:
~~~
Command line argument number 4 contains unprintable characters
~~~

Thanks
Comment 1 Cem Aydin 2014-09-30 21:26:22 UTC
The Arch bugreport: https://bugs.archlinux.org/task/41776
Comment 2 Alan Coopersmith 2014-09-30 21:43:49 UTC
--color=never is not portable to all OS'es we support.
Perhaps we should just unset GREP_OPTIONS instead?

(Though perhaps that doesn't matter since the grep usage is inside of
 an #ifdef __linux__ block in the xinit script.)
Comment 3 Cem Aydin 2014-09-30 22:56:10 UTC
Unsetting seems viable to me as well. Maybe I can do some more testing tomorrow.

Thanks
Comment 4 Hans de Goede 2014-10-01 06:57:57 UTC
Hi,

Just tuning in to this bug report. TBH my initial gut instinct to this is to close it as NOTABUG. If you set GREP_OPTIONS to color=always then you deserve all the problems you get because of that.

Just do not do that, it will likely break tons and tons of scripts everywhere. grep output is not supposed to be in color when run in a pipe, forcing it to be in color in that case is just plain stupid.

Regards,

Hans
Comment 5 Cem Aydin 2014-10-01 20:26:08 UTC
Ok, I just tested and setting GREP_OPTIONS to --color=always effectively leads to exactly the error message I posted above and hinders X from starting.

Now, as to whether this should be considered a bug or not, this is of course somehow up to you (developers) to decide. To clarify, I was not affected by this, but was trying to help someone who posted on our Arch forum.
We (people trying to help others on the forum) are just affected by this in the way that we get problems posted on the forum, with an error message, as posted above, and we're trying to figure out what's wrong... Of course we are glad if potential issues can be prevented from happening at all, as far as possible or meaningful.
Freely: "Everything that can fail, will fail."
OTOH we may all benefit from such issues by learning.

Regards & Thanks
Comment 6 Daniel Micay 2014-12-27 05:16:51 UTC
GREP_OPTIONS has been deprecated by grep upstream.
Comment 7 Evangelos Foutras 2015-03-24 07:55:08 UTC
Perhaps grep could be dropped entirely and instead do:

tty_num=${tty#/dev/tty}
Comment 8 GitLab Migration User 2018-08-10 20:30:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/app/xinit/issues/6.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.