Your message dated Tue, 23 Feb 2010 16:36:44 +0000
with message-id <[email protected]>
and subject line Bug#567104: fixed in mpg321 0.2.11-2
has caused the Debian Bug report #567104,
regarding mpg321: Does not work without a controlling terminal
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
567104: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567104
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mpg321
Version: 0.2.11-1.1
Severity: important
Tags: patch
Hi,
since version 0.2.11, mpg321 will no longer run without a controlling
terminal. This is caused by the xterm title setting code that needs a
controlling terminal and quits if it can't find one.
I've marked this bug as important, since the most common usecase for
mpg321 is probably running from music daemons like mpd or moosic. This
bug prevents mpg321 from working with moosic at least, I haven't tested
mpd.
I've attached a patch that fixes this issue. It makes mpg321 not fail
when no controlling terminal was found. Instead, it will simply skip the
terminal title setting with an error message.
This patch adds some comments and cleans up osc_print and renames it to
set_term_title, for extra source code clarity.
Gr.
Matthijs
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-rc8 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages mpg321 depends on:
ii libao2 0.8.8-5 Cross Platform Audio Output Librar
ii libc6 2.10.2-5 Embedded GNU C Library: Shared lib
ii libid3tag0 0.15.1b-10 ID3 tag reading library from the M
ii libmad0 0.15.1b-4 MPEG audio decoder library
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
mpg321 recommends no packages.
mpg321 suggests no packages.
-- no debconf information
Index: mpg321-0.2.11/mpg321.c
===================================================================
--- mpg321-0.2.11.orig/mpg321.c 2010-01-27 11:31:36.000000000 +0100
+++ mpg321-0.2.11/mpg321.c 2010-01-27 12:28:54.000000000 +0100
@@ -56,7 +56,7 @@
#include <termios.h>
#include <config.h>
-FILE *ctty, *tty_in, *tty_out;
+FILE *ctty = NULL, *tty_in = NULL, *tty_out = NULL;
int TTY_FILENO;
struct termios tty_ts, tty_ts_orig; /* termios*/
@@ -303,6 +303,7 @@
{
printf ("@R MPG123\n");
}
+ /* Find our controlling terminal, if any. */
tty_control();
/* Play the mpeg files or zip it! */
while((currentfile = get_next_file(pl, &playbuf)))
@@ -503,7 +504,7 @@
fprintf(stderr,"Playing MPEG stream from %s ...\n", basen);
/*Printing xterm title*/
- osc_print(0,0,basen);
+ set_term_title(basen);
free(dirc);
free(basec);
@@ -571,7 +572,9 @@
ao_shutdown();
/*Restoring TTY*/
set_tty_restore();
- osc_print(0,0,"Terminal");
+ /* Restore the terminal title */
+ if(!(options.opt & MPG321_QUIET_PLAY))
+ set_term_title("Terminal");
if (ctty)
fclose(ctty);
@@ -671,14 +674,13 @@
int tty_control()
{
- ctty = NULL;
-
if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) {
/* get controlling terminal */
char *program_name = "mpg321";
if ((ctty = fopen((char *)ctty_path(), "r+")) == NULL) {
- fprintf(stderr, "%s: failed to get controlling terminal\n",program_name );
- exit(EXIT_FAILURE);
+ /* This is not fatal, we just don't support raw output now
+ * (e.g., setting the xterm title) */
+ return 1;
}
}
if (!isatty(STDIN_FILENO) && ctty) {
@@ -725,9 +727,12 @@
}
-/* issue raw escape sequence */
+/* issue raw escape sequence. Can only be called when we have a
+ * controlling tty (e.g., tty_out is set) */
int raw_print(char *ctlseq)
{
+ /* tty_out should have been setup by tty_control() if available. */
+ assert(tty_out);
int c;
while ((c = *ctlseq++)) {
if (c == '\\' && *ctlseq) {
@@ -783,14 +788,18 @@
return 0;
}
-int osc_print(int ps1, int ps2, char* pt)
-{
-
- if (pt && *pt)
- snprintf(temp, sizeof(temp), "\033]%d;%s\007", ps1, pt);
- else
- snprintf(temp, sizeof(temp), "\033]%d;?\007", ps1);
- raw_print(temp);
+/* Set the xterm title and icon the the given string. Will probably work
+ * for other terminal emulators as well. Only works when we have a
+ * controlling terminal, does nothing otherwise. */
+int set_term_title(char* title)
+{
+ if (tty_out) {
+ /* See http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s3 */
+ snprintf(temp, sizeof(temp), "\033]0;%s\007", title);
+ raw_print(temp);
+ } else {
+ fprintf(stderr, "Cannot set terminal title: failed to get controlling terminal\n");
+ }
return 0;
}
--- End Message ---
--- Begin Message ---
Source: mpg321
Source-Version: 0.2.11-2
We believe that the bug you reported is fixed in the latest version of
mpg321, which is due to be installed in the Debian FTP archive:
mpg321_0.2.11-2.debian.tar.gz
to main/m/mpg321/mpg321_0.2.11-2.debian.tar.gz
mpg321_0.2.11-2.dsc
to main/m/mpg321/mpg321_0.2.11-2.dsc
mpg321_0.2.11-2_amd64.deb
to main/m/mpg321/mpg321_0.2.11-2_amd64.deb
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 [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Nanakos Chrysostomos <[email protected]> (supplier of updated mpg321 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 [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Sun, 21 Feb 2010 12:51:08 +0200
Source: mpg321
Binary: mpg321
Architecture: source amd64
Version: 0.2.11-2
Distribution: unstable
Urgency: high
Maintainer: Nanakos Chrysostomos <[email protected]>
Changed-By: Nanakos Chrysostomos <[email protected]>
Description:
mpg321 - Simple and lighweight command line MP3 player
Closes: 166512 533671 566544 567104
Changes:
mpg321 (0.2.11-2) unstable; urgency=high
.
* Fixed PATH_MAX POSIX constant needed for GNU/Hurd compilation.
* Fixed compilation errors for MIPS and MIPSEL architectures
by reporting the libmad bug to the pkg-maintainers.Bug fixed and
closed. Thanks.
* Changed to Quilt patch maintenance system.
* Added xterm title setting option so to enable/disable the feature.
Also gmusicbrowser doesn't crash anymore.
(Closes: Bug#566544),(Closes: Bug#567104).
* mpg321 can stream a URL from 0.2.10.1 version. Bug#166512 should
have already been closed. (Closes: Bug#166512).
* mpg321 has already been adopted. (Closes: Bug#533671).
Checksums-Sha1:
ab4e8b4557f8f80803a9e7c19e725b912b8b1506 1087 mpg321_0.2.11-2.dsc
46e8bd18c582de49cd1686e0c2bb465f04977d45 12541 mpg321_0.2.11-2.debian.tar.gz
843af10cdd19eacf3ac318a61dcd3b75e52eb5b4 42706 mpg321_0.2.11-2_amd64.deb
Checksums-Sha256:
49956917c0908dbd0fa5e1ad457a36c5761172148331f5e7941e8f4b4569edfc 1087
mpg321_0.2.11-2.dsc
f67b312ff119780ffdd77d34ab65179c868bb37223e9a99ca2f80373bbbe7503 12541
mpg321_0.2.11-2.debian.tar.gz
a3e8ffef0565c7ba75dd6f4ebad87e4952364f01bef87104b3ed37a2150373cf 42706
mpg321_0.2.11-2_amd64.deb
Files:
40f4b92e0a5097c0ed9c8549b1c9bfdb 1087 sound optional mpg321_0.2.11-2.dsc
35c5457ad1b78ed732a4ca8bdeeb2209 12541 sound optional
mpg321_0.2.11-2.debian.tar.gz
272cd4ed1e23235e620e99378841bec8 42706 sound optional mpg321_0.2.11-2_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkuD/GsACgkQ3DVS6DbnVgQ6MgCfTKnWqsMFcwLKtdVL5hCPqZgy
vTEAnA6srYSZfyJf0O/lSES5s2RAsOgq
=J37X
-----END PGP SIGNATURE-----
--- End Message ---