Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncthingtray PKGBUILD fails to build if port 4001 is not available #57

Closed
dinkonin opened this issue Feb 26, 2018 · 5 comments
Closed
Assignees

Comments

@dinkonin
Copy link

dinkonin commented Feb 26, 2018

When I try to build syncthingtray and port 4001 is used by another app, this happens:

1: [UR5RK] 21:28:42 FATAL: Starting API/GUI: listen tcp 127.0.0.1:4001: bind: address already in use
1: [monitor] 21:28:42 INFO: Syncthing exited: exit status 1
1: [monitor] 21:28:43 INFO: Starting syncthing
1: [monitor] 21:28:43 INFO: Signal 15 received; exiting
1: .....
1:
1:
1: !!!FAILURES!!!
1: Test Results:
1: Run: 6 Failures: 1 Errors: 0
1:
1:
1: 1) test: ConnectionTests::testConnection (F) line: 314 /tmp/syncthingtray/src/syncthingtray-0.7.3/connector/../testhelper/helper.h
1: forced failure
1: - Signal(s) error has/have not emmitted within at least 5000 ms.

When the daemon listening on 4001 is disabled it builds without problems.

@Martchus
Copy link
Owner

The testsuite actually starts a Syncthing instance and uses port 4001 for that by default. The port can be altered by setting the environment variable SYNCTHING_PORT.

Of course you could also just skip the tests using makepkg --nocheck.

Maybe I should set the default port to a less common number.

@dinkonin
Copy link
Author

I think the best way is to find a random unused port and test with it, here is a fast bash function that I use for that puprose, maybe it will help:

function EPHYMERAL_PORT(){
    LPORT=32768;
    UPORT=60999;
    while true; do
        MPORT=$[$LPORT + ($RANDOM % $UPORT)];
        (echo "" >/dev/tcp/127.0.0.1/${MPORT}) >/dev/null 2>&1
        if [ $? -ne 0 ]; then
            echo $MPORT;
            return 0;
        fi
    done
}

@Martchus
Copy link
Owner

Martchus commented Feb 26, 2018

Using this function to set the SYNCTHING_PORT environment variable would be a good solution. Would you like to send a PR? Otherwise I'll change is myself when I have time.

@dinkonin
Copy link
Author

Unfortunately, I'm a bit lost when it comes to programming (I'm just an admin, but trying to learn), so I suspect any PR request I submit will be useless.

@Martchus Martchus self-assigned this Feb 26, 2018
Martchus added a commit that referenced this issue Feb 28, 2018
@Martchus
Copy link
Owner

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants