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

'mosquitto_pub -l' doesn't see end-of-file #676

Closed
deviance opened this issue Jan 22, 2018 · 4 comments
Closed

'mosquitto_pub -l' doesn't see end-of-file #676

deviance opened this issue Jan 22, 2018 · 4 comments

Comments

@deviance
Copy link

When mosquitto_pub is run in stdin-line mode (with -l switch), then it does not recognize EOF in case of zero-length input.
I am using v1.4.14

$ LD_LIBRARY_PATH=$(pwd)/lib client/mosquitto_pub --help | head -n 2
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.
mosquitto_pub version 1.4.14 running on libmosquitto 1.4.14.

The command that hangs up is:

$ LC_ALL=en_US dd if=/dev/zero count=0 | LD_LIBRARY_PATH=$(pwd)/lib client/mosquitto_pub -h iot.eclipse.org -t test/topic -d -l
0+0 records in
0+0 records out
0 bytes copied, 4.8251e-05 s, 0.0 kB/s
Client mosqpub|11199-home-pc sending CONNECT
Client mosqpub|11199-home-pc received CONNACK

I expect the mosquitto_pub -l to behave in this regard the same as mosquitto_pub -s:

$ LC_ALL=en_US dd if=/dev/zero count=0 | LD_LIBRARY_PATH=$(pwd)/lib client/mosquitto_pub -h iot.eclipse.org -t test/topic -d -s
0+0 records in
0+0 records out
0 bytes copied, 5.2439e-05 s, 0.0 kB/s
Error: Zero length input.
Error loading input from stdin.


ralight added a commit that referenced this issue Jan 22, 2018
@ralight ralight added this to the fixes-next milestone Jan 22, 2018
@ralight
Copy link
Contributor

ralight commented Jan 22, 2018

Thanks very much, lovely and easy to reproduce. Could you check the fixes branch and close the bug if it works for you?

@deviance
Copy link
Author

This works for me, thanks.

@marwatk
Copy link

marwatk commented Jun 2, 2019

I've upgraded to 1.6.2 and I still seem to see this behavior:

root@softwareradio:~# mosquitto_pub --help | head -2
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.
mosquitto_pub version 1.6.2 running on libmosquitto 1.6.2.

root@softwareradio:~# dd if=/dev/zero count=0 | mosquitto_pub --stdin-line --topic sensors/433_raw --host <redacted> --port 1883 -d
0+0 records in
0+0 records out
0 bytes copied, 0.00390834 s, 0.0 kB/s
Client mosq/sCYUoZnobu8Y2A3y5a sending CONNECT
Client mosq/sCYUoZnobu8Y2A3y5a received CONNACK (0)

Is there a known good version I can test against to see if it's a regression?

@marwatk
Copy link

marwatk commented Jun 2, 2019

Yep, I just tried 1.5.3 and it works as it should. Looks like a regression.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants