LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-10-2015, 04:38 PM   #1
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
pulseaudio breaks xdm


One of the pulseaudio helper scripts, specifically "/etc/bash_completion.d/pacat" breaks xdm. When /etc/X11/xdm/Xsession is executed it sources it and fails:
Code:
/etc/bash_completion.d/pacat: line 6: syntax error near unexpected token `<'
/etc/bash_completion.d/pacat: line 6: `    done < <(pactl list cards short 2> /dev/null)'
It makes xdm return to login screen immediately after typing an username and password and pressing Enter. Really, annoying as hell. It took me a few hours to hunt it down. A quick search shows that the issue is know on this forum: http://www.linuxquestions.org/questi...in-4175534973/, https://www.linuxquestions.org/quest...688/page5.html. I just wanted to check if pulseaudio would make it possible to modify my wireless speakers volume on software level because ALSA cannot do that. Not only didn't, but also made me waste several hours of my life. What a sad day.
 
Old 09-10-2015, 05:35 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Maybe report this to the maintainer of the Pulseaudio SlackBuild?
 
Old 09-10-2015, 05:47 PM   #3
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Original Poster
Rep: Reputation: 220Reputation: 220Reputation: 220
PulseAudio on http://slackbuilds.org/repository/14...io/pulseaudio/ is already 6.0 and according to the Wikipedia article https://en.wikipedia.org/wiki/PulseAudio it is the newest stable release.

EDIT: I don't think it should be fixed by a package maintainer, it's a PulseAudio problem. There can be a few similar bug reports found on google

Last edited by average_user; 09-10-2015 at 05:49 PM.
 
Old 09-10-2015, 06:33 PM   #4
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by average_user View Post
PulseAudio on http://slackbuilds.org/repository/14...io/pulseaudio/ is already 6.0 and according to the Wikipedia article https://en.wikipedia.org/wiki/PulseAudio it is the newest stable release.

EDIT: I don't think it should be fixed by a package maintainer, it's a PulseAudio problem. There can be a few similar bug reports found on google
I just had a look at this (I'm interested since I am the SBo pulseaudio package maintainer) but I can't replicate the problem. I have exactly the line that is quoted in /etc/bash_completion.d/pacat (actually one of several symlinks to pulseaudio script) but no syntax problem is reported. I tried xdm in 2 ways; firstly by promoting it in rc.4, secondly by running xdm from runlevel 3 command line.

The "fix" of removing the relevant completion script is pretty unsatisfying (although I have previously suggested it myself here). As mentioned in the other report,
If you have bash-completion installed.
than pulseaudio generate errors on some systems.
.
i.e. some systems - which suggests to me that the pulseaudio bash completion script is not itself necessarily faulty, just triggering some other fault. Sorry I can't suggest what that other fault might be; and hard for me chase up myself since I can't replicate the fault.

chris
 
Old 09-11-2015, 05:53 AM   #5
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Original Poster
Rep: Reputation: 220Reputation: 220Reputation: 220
Can I ask you something - what's the shebang line in your /etc/X11/xdm/Xsession? The reason I am asking is that these two scripts behave differently:

Code:
#!/bin/bash

echo before sourcing

. /etc/bash_completion.d/pacat

echo sourcing done
Code:
#!/bin/sh

echo before sourcing

. /etc/bash_completion.d/pacat

echo sourcing done
The first one doesn't fail, the second one does. Of course, I have #!/bin/sh on the top of my Xsession.

EDIT: If you also have #!/bin/sh, are you sure that you have bash_completion.sh in /etc/profile.d/?

Last edited by average_user; 09-11-2015 at 05:54 AM.
 
Old 09-11-2015, 06:26 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Seems to me that being 'interactive' in nature, the bash completion stuff really belongs in .bashrc and not .profile, and/or at the very least should be wrapped in a
Code:
case $- in
  *i*)  # Interactive Shell invocation.
           # Insert bash completion stuff here #
        ;; 
esac
Having said that, the stock 'Xsession' file is pretty horrid, and I've never liked how it repeatedly runs through /etc/profile. I rewrote mine.

Oh, and, 'startx' isn't particularly great either.
 
Old 09-11-2015, 07:05 AM   #7
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by average_user View Post
Can I ask you something - what's the shebang line in your /etc/X11/xdm/Xsession?
My /etc/X11/xdm/Xsession has #!/bin/sh

Quote:
EDIT: If you also have #!/bin/sh, are you sure that you have bash_completion.sh in /etc/profile.d/?
Somewhat embarrassingly, no. When I made one I could see your problem with xdm immediately closing down and returning to login screen - however I didn't see your pulseaudio error messages anywhere.

However kdm worked OK and to me, that leads to the real question - why it would cause failure with xdm but not kdm? I compared the /etc/X11/xdm/Xsession with /etc/kde/kdm/Xsession and found they both sourced /etc/profile (which in turn sources scripts in /etc/profile.d, one of which now sources /etc/bash_completion/* files). The kde version sets posix compatibility mode before sourcing /etc/profile. When I changed xdm/Xsession to do the same thing, I was able to successfully log in with xdm while keeping bash completion.

If you want to try it, insert
Code:
set +o posix
immediately before line 62 (if [ -r $profile ]; then). Now your xdm might work again.

chris
 
Old 09-11-2015, 07:08 AM   #8
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Rep: Reputation: 231Reputation: 231Reputation: 231
I get a similar behavior with GDM. Is the problem pulseaudio or bash_completion?
 
Old 09-11-2015, 07:25 AM   #9
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
I just had a thought - rather than adding the posix mode in the xdm/Xsession file, it would be less intrusive if it were placed in the script that sources all the /etc/bash_completion/* files. For me, that is /etc/profile.d/bash_completion.sh, although I'll think some more about that location after GazL's comment. I add "set -o posix" in /etc/profile.d/bash_completion.sh before sourcing the bash_completion files and xdm still works.

That should work with other login managers too - would you care to try that with your GDM stormtracknole?

chris
 
Old 09-11-2015, 08:19 AM   #10
kikinovak
MLED Founder
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: CentOS, OpenSUSE
Posts: 3,453

Rep: Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154Reputation: 2154
Quote:
Originally Posted by dugan View Post
Maybe report this to the maintainer of the Pulseaudio SlackBuild?
Deleted. Wrong post. Sorry.
 
Old 09-11-2015, 09:16 AM   #11
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by chris.willing View Post
I just had a thought - rather than adding the posix mode in the xdm/Xsession file, it would be less intrusive if it were placed in the script that sources all the /etc/bash_completion/* files. For me, that is /etc/profile.d/bash_completion.sh, although I'll think some more about that location after GazL's comment. I add "set -o posix" in /etc/profile.d/bash_completion.sh before sourcing the bash_completion files and xdm still works.

That should work with other login managers too - would you care to try that with your GDM stormtracknole?

chris
I can give that a try this weekend. Thanks for the tip!
 
Old 09-11-2015, 09:45 AM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by chris.willing View Post
I just had a thought - rather than adding the posix mode in the xdm/Xsession file, it would be less intrusive if it were placed in the script that sources all the /etc/bash_completion/* files.
As long as that script itself isn't sourced, otherwise /etc/profile sources the contents of profile.d/*, and Xsession sources /etc/profile, so any set -o you issued in a script in profile.d will get sourced and apply to the shell that's actually running the entire thing. Basically, you'd still be adding posix mode to Xsession, you'd just be hiding the fact by having it nested 2 levels of sourcing down.

As I said above, bash_completion is really only helpful for interactive shells, so I'd be inclined to wrap it in the case/esac statement which would prevent it from running when Xsession sources it.


BTW, What I did with mine (though once again I've completely deviated from what ships with Slackware), is I have my Xsession source /etc/xprofile, not /etc/profile. /etc/xprofile then sources the contents of /etc/xprofile.d, which just contains symlinks to any /etc/profile.d members that are appropriate for the X11 environment. i.e. I set it up with:
mkdir /etc/xprofile.d && cd /etc/xprofile.d && ln -s ../profile.d/*.sh .

I then delete any symlinks that aren't appropriate for the X environment.

I'm happy to share my Xsession and xprofile files if people want them, but I'm going a little off-topic here, so I'll save that for another thread/day. (PM me if you're interested).

Last edited by GazL; 09-11-2015 at 09:47 AM.
 
Old 09-11-2015, 10:38 AM   #13
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Original Poster
Rep: Reputation: 220Reputation: 220Reputation: 220
Quote:
Originally Posted by chris.willing View Post
However kdm worked OK and to me, that leads to the real question - why it would cause failure with xdm but not kdm? I compared the /etc/X11/xdm/Xsession with /etc/kde/kdm/Xsession and found they both sourced /etc/profile (which in turn sources scripts in /etc/profile.d, one of which now sources /etc/bash_completion/* files). The kde version sets posix compatibility mode before sourcing /etc/profile. When I changed xdm/Xsession to do the same thing, I was able to successfully log in with xdm while keeping bash completion.
Indeed, POSIX mode is the culprit here but I thought it works the opposite way. This is why a script that sources pulseaudio completion file that has /bin/bash shebang does not crash. In man bash it says:
Code:
When invoked as sh, bash enters posix mode after the startup files are read.
As on Slackware /bin/sh is a symlink to bash, here it actually matters how the script is called. And now we might know what pulseaudio developers meant by "some systems" - those where their bash completion script is executed in POSIX mode.

I agree that completions should not be sourced for a non-interactive shell at all.

Last edited by average_user; 09-11-2015 at 10:42 AM.
 
Old 09-11-2015, 06:53 PM   #14
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Quote:
Originally Posted by GazL View Post
As long as that script itself isn't sourced, otherwise /etc/profile sources the contents of profile.d/*, and Xsession sources /etc/profile, so any set -o you issued in a script in profile.d will get sourced and apply to the shell that's actually running the entire thing. Basically, you'd still be adding posix mode to Xsession, you'd just be hiding the fact by having it nested 2 levels of sourcing down.
I was wondering about that - making everything posix through sourcing a chain of scripts. However that leads to the question of whether its a bad thing. I mean, the kdm/Xsession which I've been using (though I use XFCE desktop) already changes to posix mode anyway, regardless of any bash completion issues. Perhaps the xdm's Xsession (and any others) should be doing the same thing?

chris
 
Old 09-11-2015, 07:14 PM   #15
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Original Poster
Rep: Reputation: 220Reputation: 220Reputation: 220
I think you're wrong. kdm/Xsession does not enable POSIX mode, it disables it:

Code:
# Note that the respective logout scripts are not sourced.
case $SHELL in
  */bash)
    [ -z "$BASH" ] && exec $SHELL $0 "$@"
    set +o posix
From `help set':

Code:
Using + rather than - causes these flags to be turned off.
Compare 2 scripts with a different shebang line I posted in an earlier post and an excerpt from Bash manpage. If shebang line is /bin/sh sourcing pulseaudio completion script fails because Bash works in POSIX mode. See also here https://stackoverflow.com/questions/...s-substitution
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Xtreme Download Manager (XDM) 2015 Released, Amazing Development By Team, Install/Upgrade XDM LXer Syndicated Linux News 2 08-27-2015 07:29 AM
[SOLVED] Squeeze + Pulseaudio + Alsa and USB Midi device causes Pulseaudio crash mad4linux Debian 1 01-26-2011 03:57 AM
[SOLVED] xdm init script problem - /var/run/xdm.pid is gone ? Vilius Debian 2 09-16-2010 03:06 AM
Winecfg crashes on sound tab with Pulseaudio and no 'sounddrivers' without pulseaudio William (Dthdealer) Linux - Software 5 06-13-2010 07:30 AM
XDM opens XDM after login jpbarto Linux - Software 1 01-26-2004 10:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration