octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #50974] SEGFAULT with constructed cmdline_opti


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #50974] SEGFAULT with constructed cmdline_options
Date: Mon, 8 May 2017 18:32:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Update of bug #50974 (project octave):

                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #1:

This seems accurate to me. I have not tried to reproduce but seems easy to
demonstrate by writing a main function that calls getopt and then
instantiating an Octave application.

The GNU C library says

> The variable optind is the index of the next element to be
> processed in argv. The system initializes this value to 1. The
> caller can reset it to 1 to restart scanning of the same argv,
> or when scanning a new argument vector.

So this can be worked around on the caller side by resetting the global optind
variable to 1 after they are done with their own calls to getopt or
getopt_long from the real argv.

But ideally we will reset optind to 1 in Octave's command line parser because
it has no idea where argv came from or whether getopt had been called already.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50974>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]