cronolog exits with segmentation fault, when you use --unknown-longopt

Bug #71177 reported by Tatsuya Noda
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cronolog (Debian)
Fix Released
Unknown
cronolog (Gentoo Linux)
Fix Released
Medium
cronolog (Ubuntu)
Fix Released
Medium
Luca Falavigna

Bug Description

> % /usr/bin/cronolog --unknown-longopt
> [1] 10748 segmentation fault (core dumped) /usr/bin/cronolog --unknown-longopt

This problem caused by not null-terminated long_options near src/cronolog.c:142.

> struct option long_options[] =
> {
...
> { "version", no_argument, NULL, 'V' }
> };

BTW, Maybe we need to do s/--prevlink/--prev-symlink/g in manual page.

Related branches

Revision history for this message
In , Joel Aelwyn (fenton) wrote : Forwarded Debian Bug (#217554): man page typo

tags 217554 +forwarded
thanks

[ The above are control messages for Debian's BTS ]

Daniel Freedman submitted bug #217554 to the Debian BTS some time ago; I
apologize for not having forwarded this to you until now. If you do not
intend to release a new version of cronolog in the reasonably immediate
future (and I do realize you're short on time), I'll apply it to the Debian
package of 1.6.2, for now.

Thank you for your time and effort on cronolog; hopefully this patch will
help to improve it further.

I also have a second patch from Mr. Freedman, which I will send immediately
after this one.

From: Daniel Freedman <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: Bug#217554: cronolog: man page typo [patch]
Reply-To: Daniel Freedman <email address hidden>, <email address hidden>

Package: cronolog
Version: N/A; reported 2003-10-25
Severity: minor
Tags: patch

Hi,

Here's a very short patch to fix the typo in the manpage, where one of
the command line options doesn't agree with the source or the command's
default output help.

warthog:~# diff -C4 cronolog.1m cronolog.1m.orig
*** cronolog.1m Sat Oct 25 14:29:46 2003
--- cronolog.1m.orig Sat Oct 25 14:29:08 2003
***************
*** 76,84 ****
  .I NAME
  to the current log file.
  .\"
  .IP "-P \fINAME\fP"
! .IP "--prev-symlink=\fINAME\fP"
  maintain a symbolic link from
  .I NAME
  to the previous log file. Requires that the
  .B "--symlink"
--- 76,84 ----
  .I NAME
  to the current log file.
  .\"
  .IP "-P \fINAME\fP"
! .IP "--prevlink=\fINAME\fP"
  maintain a symbolic link from
  .I NAME
  to the previous log file. Requires that the
  .B "--symlink"
warthog:~#

--
Joel Baker <email address hidden> ,''`.
Debian GNU NetBSD/i386 porter : :' :
                                                                     `. `'
                                           `-

Revision history for this message
In , Joel Aelwyn (fenton) wrote : Updating bugs

tags 217554 +confirmed
tags 217554 +upstream

tags 217566 +confirmed
tags 217566 +upstream
thanks
--
Joel Baker <email address hidden> ,''`.
Debian GNU/KLNetBSD(i386) porter : :' :
                                                                     `. `'
                                           `-

Revision history for this message
Tatsuya Noda (topia) wrote :

> % /usr/bin/cronolog --unknown-longopt
> [1] 10748 segmentation fault (core dumped) /usr/bin/cronolog --unknown-longopt

This problem caused by not null-terminated long_options near src/cronolog.c:142.

> struct option long_options[] =
> {
...
> { "version", no_argument, NULL, 'V' }
> };

BTW, Maybe we need to do s/--prevlink/--prev-symlink/g in manual page.

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Thanks in advance.

Changed in cronolog:
status: New → Incomplete
Revision history for this message
Carlo Marcelo Arenas Belon (carenas) wrote :

this bug reports 2 different problems and proposed fixes which are both still valid (the segfault reproduced in amd64, and the documentation problem in any system I'd tried).

the documentation problem has been also reported in debian (including a fix) as shown by :

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=217554

Revision history for this message
Carlo Marcelo Arenas Belon (carenas) wrote :

getopt_long requires that the last record in the longopts array is filled with 0 as documented in getopt(3)

Revision history for this message
Carlo Marcelo Arenas Belon (carenas) wrote :

equivalent to the patch reported in debian but in unified/non reverse format to simplify using it. also sent upstream and reported to Gentoo in :

  http://bugs.gentoo.org/show_bug.cgi?id=204521

Changed in cronolog:
status: Unknown → Confirmed
Changed in cronolog:
status: Confirmed → Fix Released
Revision history for this message
Tatsuya Noda (topia) wrote :

I'm sorry to long offline.
Two problems are still exists, and these patches are nice (tested on amd64/intrepid).
Thanks for making patches.

Changed in cronolog:
status: New → Unknown
Changed in cronolog:
status: Unknown → Confirmed
Daniel T Chen (crimsun)
Changed in cronolog:
importance: Undecided → Medium
status: Incomplete → Triaged
Changed in cronolog:
status: Confirmed → Unknown
Changed in cronolog:
status: Unknown → Fix Released
Revision history for this message
Tatsuya Noda (topia) wrote :

Why cronolog (Debian) linked to gentoo-bugs #204519, or really fix released in Debian?

so, how long will it take before this minor bug will fixed?
Two patches on attachment works well for me...

Changed in cronolog:
status: Fix Released → Unknown
Changed in cronolog:
assignee: nobody → dktrkranz
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cronolog - 1.6.2-5.3ubuntu1

---------------
cronolog (1.6.2-5.3ubuntu1) jaunty; urgency=low

  * debian/patches/050_cronolog_getopt_long.diff (LP: #71177):
    - Last record of a struct option must be NULL, so add a NULL record at
      the bottom of long_options, thanks Carlo Marcelo Arenas Belon!

 -- Luca Falavigna <email address hidden> Sat, 21 Feb 2009 11:45:28 +0100

Changed in cronolog:
status: In Progress → Fix Released
Changed in cronolog:
status: Unknown → Confirmed
Changed in cronolog (Gentoo Linux):
importance: Unknown → Medium
Changed in cronolog (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.