Debian Bug report logs -
#703894
Please add patch to disable buffering of stdout when not a tty
Reported by: Michael Stapelberg <stapelberg@debian.org>
Date: Mon, 25 Mar 2013 13:21:01 UTC
Severity: wishlist
Tags: upstream
Found in version qcontrol/0.4.2+svn-r40-3
Fixed in version qcontrol/0.5.1-1
Done: Ian Campbell <ijc@hellion.org.uk>
Bug is archived. No further changes may be made.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Ian Campbell <ijc@hellion.org.uk>:
Bug#703894; Package qcontrol.
(Mon, 25 Mar 2013 13:21:05 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Stapelberg <stapelberg@debian.org>:
New Bug report received and forwarded. Copy sent to Ian Campbell <ijc@hellion.org.uk>.
(Mon, 25 Mar 2013 13:21:05 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
Package: qcontrol
Version: 0.4.2+svn-r40-3
Severity: wishlist
Attached you can find a patch which disables buffering of stdout when
stdout is not a tty. From the code:
+ /* Disable buffering for stdout if stdout is not a tty.
+ * This is necessary when redirecting stdout to a file
+ * or — as is the case with systemd — to the journal
+ * socket. Otherwise, messages are only received very
+ * rarely when the buffer fills up. */
Please add this patch in your next upload.
[dont-buffer-stdout.patch (text/x-diff, attachment)]
Added tag(s) upstream.
Request was from Ian Campbell <ijc@hellion.org.uk>
to control@bugs.debian.org.
(Sat, 04 May 2013 15:51:15 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org:
Bug#703894; Package qcontrol.
(Sat, 04 May 2013 17:00:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Ian Campbell <ijc@hellion.org.uk>:
Extra info received and forwarded to list.
(Sat, 04 May 2013 17:00:04 GMT) (full text, mbox, link).
Message #12 received at 703894@bugs.debian.org (full text, mbox, reply):
[Message part 1 (text/plain, inline)]
On Mon, 2013-03-25 at 14:18 +0100, Michael Stapelberg wrote:
> Package: qcontrol
> Version: 0.4.2+svn-r40-3
> Severity: wishlist
>
> Attached you can find a patch which disables buffering of stdout when
> stdout is not a tty. From the code:
>
> + /* Disable buffering for stdout if stdout is not a tty.
> + * This is necessary when redirecting stdout to a file
> + * or — as is the case with systemd — to the journal
> + * socket. Otherwise, messages are only received very
> + * rarely when the buffer fills up. */
Thanks for the patch.
Do you not also care about stderr? Perhaps an explicit flush in
print_log would be just as good, something like:
diff --git a/qcontrol.c b/qcontrol.c
index f143a8d..50cf1c8 100644
--- a/qcontrol.c
+++ b/qcontrol.c
@@ -92,13 +92,10 @@ int print_log(int priority, const char *format, ...)
if (g_use_syslog == true) {
vsyslog(priority, format, ap);
} else {
- if (priority == LOG_ERR) {
- err = vfprintf(stderr, format, ap);
- printf("\n");
- } else {
- err = vprintf(format, ap);
- printf("\n");
- }
+ FILE *f = (priority == LOG_ERR) ? stderr : stdout;
+ err = vfprintf(f, format, ap);
+ fprintf(f, "\n");
+ fflush(f);
}
va_end(ap);
Ian.
[signature.asc (application/pgp-signature, inline)]
Reply sent
to Ian Campbell <ijc@hellion.org.uk>:
You have taken responsibility.
(Sun, 12 May 2013 18:51:19 GMT) (full text, mbox, link).
Notification sent
to Michael Stapelberg <stapelberg@debian.org>:
Bug acknowledged by developer.
(Sun, 12 May 2013 18:51:19 GMT) (full text, mbox, link).
Message #17 received at 703894-close@bugs.debian.org (full text, mbox, reply):
Source: qcontrol
Source-Version: 0.5.1-1
We believe that the bug you reported is fixed in the latest version of
qcontrol, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 703894@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Ian Campbell <ijc@hellion.org.uk> (supplier of updated qcontrol package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sun, 12 May 2013 19:25:57 +0100
Source: qcontrol
Binary: qcontrol qcontrol-udeb
Architecture: source armel
Version: 0.5.1-1
Distribution: sid
Urgency: low
Maintainer: Ian Campbell <ijc@hellion.org.uk>
Changed-By: Ian Campbell <ijc@hellion.org.uk>
Description:
qcontrol - hardware control for QNAP Turbo Station devices
qcontrol-udeb - hardware control for QNAP Turbo Station devices (udeb)
Closes: 697574 703888 703894
Changes:
qcontrol (0.5.1-1) unstable; urgency=low
.
* New upstream release.
- Wake-on-Lan support. (Closes: #703888)
- Support for qcontrol.d directories. (Closes: #697574)
- Disable buffering when stdout/err is not a tty. (Closes: #703894)
- Patches merged upstream.
* Only require event-modules udeb on armel.
* Add /etc/qcontrol.d include to config files and package the directory
Checksums-Sha1:
7e75d241d3eaa4b1f85bc684702a903dd97e23e2 1935 qcontrol_0.5.1-1.dsc
880f1b8a36e93f5d729cff50719a55f1b1be2594 21920 qcontrol_0.5.1.orig.tar.xz
0ced78b8e4bf9d3ea80929a1505ed1d5409a2466 11543 qcontrol_0.5.1-1.debian.tar.gz
822430e9eff095c6be2dccc7c8cd10447baf96aa 24992 qcontrol_0.5.1-1_armel.deb
c1066bc38d05f9a156dac1e8fc48f7ad5fc81be6 61094 qcontrol-udeb_0.5.1-1_armel.udeb
Checksums-Sha256:
c852a35f5bb08b51db9f2c9a54461fd13b3a86725c1d4e8337e188ec0784704f 1935 qcontrol_0.5.1-1.dsc
2023ca8c4eebfb85cb26583ae1674bb2d92fedce93af4a469c113f2e4ef1adf4 21920 qcontrol_0.5.1.orig.tar.xz
1aa892639ba45ae8a9648b25868b3e636c5f1eb18bc5905636947f07a50b4d80 11543 qcontrol_0.5.1-1.debian.tar.gz
d3dbece50ea93360413b2dd0dc9352e3b36ba80e96c881978dc3df2173a17245 24992 qcontrol_0.5.1-1_armel.deb
e92c18cad306fed0808cbbe9436b26c08494f9e0ce310f6c5a82f8b90ba9fd53 61094 qcontrol-udeb_0.5.1-1_armel.udeb
Files:
fc4173a4af9d7c921a20f67d99942000 1935 utils optional qcontrol_0.5.1-1.dsc
b66598c724a1bd2f7fb24aa975011755 21920 utils optional qcontrol_0.5.1.orig.tar.xz
d4a2f8220ed46ea5396485087956f7bd 11543 utils optional qcontrol_0.5.1-1.debian.tar.gz
d52cd9d78881e8df3ddc7abdad24563b 24992 utils optional qcontrol_0.5.1-1_armel.deb
7c74397988ff52d5c1203befa8d16ca4 61094 debian-installer optional qcontrol-udeb_0.5.1-1_armel.udeb
Package-Type: udeb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAEBCAAGBQJRj+GJAAoJECouJZ9pWkbGK9UP/RZu964lFEPDLthH9ZRCbYrh
5TXGSNv8jZegEUbyeBmsjhs2c1TpcDjEsy75iLWY9sx9LLgsmcqIDVa63jpUZG50
cy5LajEp0ZihN3QEnPnxJFBRlGEUEIdT453O7N8HM7WOPSUpeElczy6QF/FjR/nJ
7vSLeMHCFFYM7HyvMEA73I5opo3WAsJU96c0tkkjY5OWScLgb7BSPMXoMhvgjXkz
ZwPYIm3QP7ySuJAJpUnLk5CJyEbjnDa7Veje9WAbLja/kY4FxdBF63om20ORGkSs
ZlpdCjCU6jpgK4WmUvSC6UMZt1VL8B4ZEnrtIJ6gS5bD6MYggOofA/NDHxxY7rZ0
je/vcx180C6/qOHK6TR/uCs2jkAzfZsBeQeJ8Auvz115QNVV7BOq98yztkb+Z3tF
RkxCIDPPnBiyQagAe+Vp/+LJfbhwvFn6UdZy1a5IVE1AVs1NkAgAQVAlH42HJCxb
6qH2Li2sn/dFJwuim25DUqAn8jPXmMNHnOckFAcZVgN1N4UDceCj3VFcIoh4wCsL
qT2KayeVtucicCmPmCZ3Qp9jocRDoRHhlcm1N73hG+6Yc/rrCNZ/BpgmeQB63iVW
aulVbkQ2DWhYwW7xJuqVDwQ/kTRy/N7d7Q6bHkapwem42/5G9qE/Zl0lDDjkTAGh
fiGqmFf83fPCu1Tj8TCP
=eHGc
-----END PGP SIGNATURE-----
Information forwarded
to debian-bugs-dist@lists.debian.org, Ian Campbell <ijc@hellion.org.uk>:
Bug#703894; Package qcontrol.
(Mon, 20 May 2013 20:57:21 GMT) (full text, mbox, link).
Acknowledgement sent
to Michael Stapelberg <stapelberg@debian.org>:
Extra info received and forwarded to list. Copy sent to Ian Campbell <ijc@hellion.org.uk>.
(Mon, 20 May 2013 20:57:21 GMT) (full text, mbox, link).
Message #22 received at 703894@bugs.debian.org (full text, mbox, reply):
Hi Ian,
Ian Campbell <ijc@hellion.org.uk> writes:
> Do you not also care about stderr? Perhaps an explicit flush in
> print_log would be just as good, something like:
True, this should also be done for stderr.
> diff --git a/qcontrol.c b/qcontrol.c
> index f143a8d..50cf1c8 100644
> --- a/qcontrol.c
> +++ b/qcontrol.c
> @@ -92,13 +92,10 @@ int print_log(int priority, const char *format, ...)
> if (g_use_syslog == true) {
> vsyslog(priority, format, ap);
> } else {
> - if (priority == LOG_ERR) {
> - err = vfprintf(stderr, format, ap);
> - printf("\n");
> - } else {
> - err = vprintf(format, ap);
> - printf("\n");
> - }
> + FILE *f = (priority == LOG_ERR) ? stderr : stdout;
> + err = vfprintf(f, format, ap);
> + fprintf(f, "\n");
> + fflush(f);
> }
Looks good to me.
I see that you already applied the patch. Thanks!
--
Best regards,
Michael
Bug archived.
Request was from Debbugs Internal Request <owner@bugs.debian.org>
to internal_control@bugs.debian.org.
(Tue, 18 Jun 2013 07:34:17 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Fri Jan 19 05:45:50 2024;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.