[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#528783: marked as done (bogl: support 'bterm [options] -- command [arguments]')



Your message dated Tue, 22 Jun 2010 00:32:09 +0000
with message-id <E1OQrPN-0000JD-Ug@ries.debian.org>
and subject line Bug#528783: fixed in bogl 0.1.18-4
has caused the Debian Bug report #528783,
regarding bogl: support 'bterm [options] -- command [arguments]'
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 owner@bugs.debian.org
immediately.)


-- 
528783: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528783
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: bogl
Version: 0.1.18-3
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch karmic

bterm's command-line syntax currently only supports invocations of the
following form:

  bterm [options] [command]

... where the options and the command name may be interleaved. This is
inconvenient if you want to run a command that takes arguments inside
bterm, especially if any of those arguments start with "-"; you have to
write a wrapper script, and if you want any of those arguments to be
variable then you need to pass them through using environment variables.
It would be much better if bterm supported a sensible adverbial style of
invocation.

The attached patch changes bterm to support an additional syntax of the
following form:

  bterm [options] -- command [arguments]

I believe that it is fully backward-compatible with the previous syntax.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
diff -Nru bogl-0.1.18/bterm.c bogl-0.1.18/bterm.c
--- bogl-0.1.18/bterm.c	2009-04-23 16:46:07.000000000 +0100
+++ bogl-0.1.18/bterm.c	2009-05-15 15:41:57.000000000 +0100
@@ -66,6 +66,26 @@
 static struct termios ttysave;
 static int quit = 0;
 
+/* Out of memory.  Give up. */
+static void out_of_memory (void)
+{
+  fprintf (stderr, "virtual memory exhausted\n");
+  abort ();
+}
+
+/* Allocate AMT bytes of memory and make sure it succeeded. */
+static void *xmalloc (size_t size)
+{
+  void *p;
+  
+  if (size == 0)
+    return 0;
+  p = malloc (size);
+  if (!p)
+    out_of_memory ();
+  return p;
+}
+
 /* This first tries the modern Unix98 way of getting a pty, followed by the
  * old-fashioned BSD way in case that fails. */
 int get_ptytty(int *xptyfd, int *xttyfd)
@@ -145,7 +165,7 @@
 	quit = 1;
 }
 
-void spawn_shell(int ptyfd, int ttyfd, const char *command)
+void spawn_shell(int ptyfd, int ttyfd, char * const *command_args)
 {
   fflush(stdout);
   child_pid = fork();
@@ -170,7 +190,7 @@
   setgid(getgid());
   setuid(getuid());
 
-  execl(command, command, NULL);
+  execvp(command_args[0], command_args);
   exit(127);
 }
 
@@ -224,11 +244,13 @@
   int ptyfd, ttyfd;
   struct bogl_font *font;
   char *locale = "", *command = NULL;
+  char **command_args;
   int i;
   char o = ' ';
   int pending = 0;
 
-  for (i = 1 ; i < argc ; ++i)
+  for (i = 1 ; i < argc ; ++i) {
+      int done = 0;
       if (argv[i][0] == '-')
           switch (argv[i][1])
           {
@@ -237,6 +259,10 @@
                   o = argv[i][1];
                   break;
 
+              case '-':
+                  done = 1;
+                  break;
+
               default:
                   printf ("unknown option: %c\n", argv[i][1]);
           }
@@ -258,6 +284,10 @@
                     break;
             }
 
+      if (done)
+          break;
+  }
+
   setlocale(LC_CTYPE, locale);
 
   if (font_name == NULL) {
@@ -291,7 +321,22 @@
     exit(1);
   }
 
-  spawn_shell(ptyfd, ttyfd, command == NULL ? "/bin/sh" : command);
+  if (command) {
+    command_args = xmalloc(2 * sizeof *command_args);
+    command_args[0] = command;
+    command_args[1] = NULL;
+  } else if (i < argc - 1) {
+    int j;
+    command_args = xmalloc((argc - i) * sizeof *command_args);
+    for (j = i + 1; j < argc; ++j)
+      command_args[j - (i + 1)] = argv[j];
+    command_args[argc - (i + 1)] = NULL;
+  } else {
+    command_args = xmalloc(2 * sizeof *command_args);
+    command_args[0] = "/bin/sh";
+    command_args[1] = NULL;
+  }
+  spawn_shell(ptyfd, ttyfd, command_args);
 
   signal(SIGHUP, reload_font);
   signal(SIGTERM, sigterm);

--- End Message ---
--- Begin Message ---
Source: bogl
Source-Version: 0.1.18-4

We believe that the bug you reported is fixed in the latest version of
bogl, which is due to be installed in the Debian FTP archive:

bogl-bterm-udeb_0.1.18-4_amd64.udeb
  to main/b/bogl/bogl-bterm-udeb_0.1.18-4_amd64.udeb
bogl-bterm_0.1.18-4_amd64.deb
  to main/b/bogl/bogl-bterm_0.1.18-4_amd64.deb
bogl_0.1.18-4.dsc
  to main/b/bogl/bogl_0.1.18-4.dsc
bogl_0.1.18-4.tar.gz
  to main/b/bogl/bogl_0.1.18-4.tar.gz
libbogl-dev_0.1.18-4_amd64.deb
  to main/b/bogl/libbogl-dev_0.1.18-4_amd64.deb
libbogl0_0.1.18-4_amd64.deb
  to main/b/bogl/libbogl0_0.1.18-4_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 528783@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Steve Langasek <vorlon@debian.org> (supplier of updated bogl 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: Tue, 22 Jun 2010 00:06:57 +0000
Source: bogl
Binary: libbogl-dev libbogl0 bogl-bterm bogl-bterm-udeb
Architecture: source amd64
Version: 0.1.18-4
Distribution: unstable
Urgency: low
Maintainer: Debian QA Group <packages@qa.debian.org>
Changed-By: Steve Langasek <vorlon@debian.org>
Description: 
 bogl-bterm - Ben's Own Graphics Library - graphical terminal
 bogl-bterm-udeb - Ben's Own Graphics Library - graphical terminal (udeb)
 libbogl-dev - Ben's Own Graphics Library - development files
 libbogl0   - Ben's Own Graphics Library - shared library
Closes: 528783
Changes: 
 bogl (0.1.18-4) unstable; urgency=low
 .
   * QA upload.
   * If a "--" argument is encountered on bterm's command line, terminate
     option processing there and accept arguments after the command name.
     Thanks to Colin Watson <cjwatson@ubuntu.com> for the patch.
     Closes: #528783.
   * Drop gratuitous hardcoded ldconfig call in libbogl0 postinst.
   * Drop redundant debian/foo.dirs.
   * Update standards-version to 3.8.4, no changes required.
Checksums-Sha1: 
 7dac20744206750e8b825f6bcc4035a889ae4848 1431 bogl_0.1.18-4.dsc
 b2f27b28755c14ae3b8680f82bbca74487e9ab45 103590 bogl_0.1.18-4.tar.gz
 1f755640dd1be18873ac4871f7edccf4f80a0f41 92092 libbogl-dev_0.1.18-4_amd64.deb
 4f4721f2eef65f317ff742342ec7b881e69e9027 53338 libbogl0_0.1.18-4_amd64.deb
 3e426aadc14588a2afa46355d4bd2fbc95cfe379 30782 bogl-bterm_0.1.18-4_amd64.deb
 d353fe4878b4427a1913482d519ba376fd6a69f6 24940 bogl-bterm-udeb_0.1.18-4_amd64.udeb
Checksums-Sha256: 
 829cae2175cee773c672ca6b273b3698bcf705130b0caa4e48e0956cdb62f60b 1431 bogl_0.1.18-4.dsc
 318080cdf2f789c999bcdefd067aef25516346330090ee810c7066b0cb1c9593 103590 bogl_0.1.18-4.tar.gz
 9592d3e4bc302d56c96d495af2de4e57944c3af6e5f2abcca1c315ad470d11ad 92092 libbogl-dev_0.1.18-4_amd64.deb
 2c4297ae9db246e03d89fe162e12dd88423c5bbb227e59d22748ad0f5accb6d2 53338 libbogl0_0.1.18-4_amd64.deb
 c9f8e1a75b19e463b4b0cd0b731c4f62acd9e94ea42e52e8bd89838d67949d90 30782 bogl-bterm_0.1.18-4_amd64.deb
 dfd2313bd08d61262f8184dbcb1748207b7b78a41dde28e04bbdc3f57e4176f6 24940 bogl-bterm-udeb_0.1.18-4_amd64.udeb
Files: 
 4dc7ca22318b514f638f1285864d3795 1431 devel optional bogl_0.1.18-4.dsc
 bc3f307b7561863891aa398482d80ca7 103590 devel optional bogl_0.1.18-4.tar.gz
 725918dcea565c53f97f5c3aa1643775 92092 libdevel optional libbogl-dev_0.1.18-4_amd64.deb
 f8d1972cbd9bf8c40b86b18a89572987 53338 libs optional libbogl0_0.1.18-4_amd64.deb
 c25afb84e1ea5100e04fff66df65c51d 30782 utils optional bogl-bterm_0.1.18-4_amd64.deb
 b3cc44f7f9b127cb67fcc41fb00fcc0d 24940 debian-installer extra bogl-bterm-udeb_0.1.18-4_amd64.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIVAwUBTCABG1aNMPMhshM9AQjJew//VwiVc9ByE+bLi02rHtkg50TMdFHY2wpo
vPlnpm3kjr5vUe6DNVqrJ80AZed8aXwGLUA73E58D4DmjhHPn352awrlx+hcI3m1
wDeBJvTB3buSDZyFrF0ZcFdv8Xs9ThlexbrymSZ9bzOlbFgKveuIeybRkfoCka68
Bm2sDC4V82Nfm7cJ9AHxo2JHRb5jTOP+acmShKXAyPadjQP95P2SVJ74Bk4umkj3
L7cCnb1d6RSR+F7SnnsBFVGpJNxyeqii8jFP1bgpLoAEcyFMqQfb1EvjD2hoxSnE
Sp+lsVOgPa6zQtBQr03vtgQUVnMA5kQSVQYjOgmgKGRS8hRmDA13eZv2uxoWOop/
CziUW/lv1WFC5b0PlHh79FVSEcua4AaN6IXn8SRjAqYP/6rg3hrm/zeYrgmwBTxO
krgHouXg1N4GAnxoiA3YDoBr77yBZywey3F8gxXIx0f2DUBhOuIA0vCBBJDeHup5
21dCl1BukiT4eOt7wFF28IeHcmq814OaHDEmFIjec/IzaKvP57ZidoCkYOm9gKZy
GBVSlBJW0HJcbjtGCHvg+lMUWp0PL4QBpCToqN4YwZHUg7pbGTw8Of2m15juZaU7
6Jrs2Wim8Fbc32pX8e+BMyYSWVKHMJcHmGXfJig7bM0kDqpOt0KYGZ/F/XZ95NhH
0WWlbE9Y5t4=
=YlNK
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: