Giter VIP home page Giter VIP logo

Comments (13)

varac avatar varac commented on May 25, 2024

btw, same error happens when using make deb from the 1.2 tag.
I'm using ubuntu artful 17.10 (but inside an Xorg session)

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

I frankly don't quite understand how this can happen. Python emits this error message if the name of an environment variable contains a =, but the way autorandr is programmed it should never try to do that.

Could you please add to autorandr.py, after line 909,

    for environ_entry in open(environ_file).read().split("\0"):

a new line

        print(repr(environ_entry))

and check whether the journald log contains a suspicious entry (with a nonprintable character or multiple ='s or something like that) before the error message?

from autorandr.

varac avatar varac commented on May 25, 2024

Weird, I cannot reproduce this anymore. Everything works fine, besides a segault in the logs (#90).

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

Ok, just drop a note if the bug resurfaces - closing this for now :-)

(Btw, issues with parts of this code are always semi-random, because whether they surface depends on which processes have which PIDs on your system.)

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

Oh, there is one thing you could still try. Please run this as root and check whether it prints something:

#!/usr/bin/env python
# encoding: utf-8
import os


for directory in os.listdir("/proc"):
    directory = os.path.join("/proc/", directory)
    if not os.path.isdir(directory):
        continue
    environ_file = os.path.join(directory, "environ")
    if not os.path.isfile(environ_file):
        continue

    process_environ = {}
    for environ_entry in open(environ_file).read().split("\0"):
        if "=" in environ_entry:
            name, value = environ_entry.split("=", 1)
            process_environ[name] = value

    try:
        os.environ.clear()
        os.environ.update(process_environ)
    except:
        print(process_environ)
        break

The script tries to extract the environment of all processes and update it's own environment accordingly - hopefully, this'll fail for some process.

from autorandr.

varac avatar varac commented on May 25, 2024

@phillipberndt I ran it as root multiple times and it prints env variables without failure.

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

If it prints something that's a sign of failure :) Could you share the output please?

from autorandr.

varac avatar varac commented on May 25, 2024

@phillipberndt : sorry, too many private env variables in the output that I don't want to share/scrape out.

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

Fair enough. It'd suffice to extract the one, single variable which leads to the failure:

#!/usr/bin/env python
# encoding: utf-8
import os
import sys


for directory in os.listdir("/proc"):
    directory = os.path.join("/proc/", directory)
    if not os.path.isdir(directory):
        continue
    environ_file = os.path.join(directory, "environ")
    if not os.path.isfile(environ_file):
        continue

    for environ_entry in open(environ_file).read().split("\0"):
        if "=" in environ_entry:
            name, value = environ_entry.split("=", 1)

            try:
                os.environ.clear()
                os.environ.update({name: value})
            except:
                print(repr({name: value}))
                sys.exit(0)

from autorandr.

varac avatar varac commented on May 25, 2024

ok, here's the output:

set(['', '33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*,v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:'])

from autorandr.

blueyed avatar blueyed commented on May 25, 2024

Looks like something from LS_COLORS - and then it might possibly be split?! (since it tends to be very long)

@varac
You can adjust the script above to print(directory), which should be the PID and from there figure out what process it is.

from autorandr.

varac avatar varac commented on May 25, 2024

Do you mean like this ?

...
/proc/3122
/proc/3205
/proc/3212
/proc/3858
/proc/3889
/proc/4077
/proc/5744
/proc/5749
/proc/5751
/proc/6078
/proc/6081
/proc/6089
/proc/6091
/proc/6147
{'': '33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*,v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:'}
--- /tmp » ls /proc/6147/cmdline 
/proc/6147/cmdline
--- /tmp » cat /proc/6147/cmdline
/usr/lib/chromium-browser/chromium-browser ...

from autorandr.

phillipberndt avatar phillipberndt commented on May 25, 2024

@blueyed Thanks for your PR & the help!

@varac Thanks for the debug info! The only way I can explain myself how this happens is that the process generating the LS_COLORS variable inserts a null-byte after one of the file extensions. I.e. ..:*.foo\0=33:*.yuv=... Since null-bytes separate environment variables, that's a bug, but indeed a case autorandr should handle.

from autorandr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.