Bug 218389 - audio/pd won't run with GUI under X with shells/bash as default shell
Summary: audio/pd won't run with GUI under X with shells/bash as default shell
Status: Closed Unable to Reproduce
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Tobias Kortkamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-05 06:04 UTC by gen-freebsd
Modified: 2019-02-03 05:50 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gen-freebsd 2017-04-05 06:04:06 UTC
[thom@sasquatch ~]$ uname -a
FreeBSD sasquatch 11.0-RELEASE-p8 FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

# pkg install pd

[thom@sasquatch ~]$ pd
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
priority 7 scheduling failed.
bind: Address already in use
Pd needs your machine to be configured with
'networking' turned on (see Pd's html doc for details.)


watchdog: signaling pd...
watchdog: signaling pd...
watchdog: signaling pd...


also nothing appears to happen when i run (in bash)

[thom@sasquatch ~]$ pd -guiport 127.0.0.1:5400
[thom@sasquatch ~]$ 


No GUI appears.


The audio/pd maintainer confirmed the same issue after using chsh to change to bash from tcsh, and advised me to file this bug, adding "you need to log in with a shell that can locate pd's gui socket.

I *think* this is a bug in how FreeBSD handles korn and bourne shells installed
from ports. I haven't tested zsh or fish. "

Workaround is to use tcsh in the meantime.
Comment 1 Tobias Brodel 2017-04-07 00:47:25 UTC
(In reply to gen-freebsd from comment #0)

hi, maintainer of audio/pd here.

i can confirm this bug is present using either shells/bash or shells/mksh as login shell.

the bug is triggered by a call to bind(2) failing:

while (bind(xsock, (struct sockaddr *)&server, sizeof(server)) < 0) {
        int err = errno;
        if ((ntry++ > 20) || (err != EADDRINUSE)) {
                perror("bind");
                fprintf(stderr, "Pd needs your machine to be configured with\n");                   
                fprintf(stderr, "'networking' turned on (see Pd's html doc for details.)\n");
                return (1);
        }
        portno++;
        server.sin_port = htons((unsigned short)(portno));                   
}

some cursory debugging seems to suggest that when using bash or mksh as login shell errno is set to EADDRINUSE and stays there for the next twenty attempts, meaning that ports r5400..5420 on localhost are all unavailable (unlikely).

this is not the case using {t,}csh or sh, which leads me to believe that the bug is somewhere in these ported shells.

note that this bug does not appear when using bash on Linux or ksh on OpenBSD, which makes me think this is not an issue with the audio/pd codebase itself.

best,
t/
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2019-02-03 05:50:30 UTC
I'm closing this because 

a) I cannot reproduce this with bash 5.0.2 as login shell and pd 0.47.1
   on FreeBSD 13.0-CURRENT
b) there were no new comments or other changes here for > 1.5 years

If this is still a problem for you please let me know and we can
reopen.