Skip to content
This repository was archived by the owner on Nov 8, 2017. It is now read-only.

Master#3

Open
JohnOH wants to merge 7 commits intofalzm:masterfrom
JohnOH:master
Open

Master#3
JohnOH wants to merge 7 commits intofalzm:masterfrom
JohnOH:master

Conversation

@JohnOH
Copy link

@JohnOH JohnOH commented Jul 30, 2017

In some instances failure to open has caused the printf output to
appear in other processes.

JohnOH added 2 commits July 30, 2017 10:41
In some instances failure to open has caused the printf output to
appear in other processes.
burl Outdated

exec 3<>/dev/tcp/${host}/${HTTP_PORT}
if exec 3<>/dev/tcp/${host}/${HTTP_PORT}; then

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't leave empty line after if statement.

burl Outdated
[[ $path == $host ]] && path=""

exec 3<>/dev/tcp/${host}/${HTTP_PORT}
if exec 3<>/dev/tcp/${host}/${HTTP_PORT}; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please enclose condition statement within [[ ]] brackets:

if [[ exec 3<>/dev/tcp/${host}/${HTTP_PORT} ]]; then

@JohnOH
Copy link
Author

JohnOH commented Jul 30, 2017

Changes applied.

I am unable to use [[ … ]] as you request.
@falzm
Copy link
Owner

falzm commented Jul 31, 2017

I'm sorry but your change doesn't fix anything, I get the same error with and without it when I execute the script with a non-existent domain name:

$ ./burl ietf.or
./burl: line 17: ietf.or: nodename nor servname provided, or not known
./burl: line 17: /dev/tcp/ietf.or/80: Invalid argument
31/07/2017 19:41:16 unable to connect: ietf.or:80/

@JohnOH
Copy link
Author

JohnOH commented Jul 31, 2017

I didn't explain things too well. The change fixes the impact of the printf outputting to the unopened file descriptor number 3. It does this by only executing the printf etc lines if the exec 3 file descriptor open is successful. It obviously isn't possible to fix connections to unreachable sites in the script.

@JohnOH
Copy link
Author

JohnOH commented Jul 31, 2017

On my system which uses a pipe for inter-process communication writing to the unopened file descriptor 3 actually presents the contents of the printf to my process through its pipe. This impacted process is a separate executable, I suspect an issue somewhere in Linux triggered by the open failure in the burl script. I beleive I have worked around this internal issue by only using the file descriptor once it has opened correctly.

Also add post bash script. A lighter than burl when no response is
required.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants