bugGNU Octave - Bugs: bug #41260, regression in urlread: second...

 
 

bug #41260: regression in urlread: second return value may be undefined

Submitter:  Julien Bect <jbect>
Submitted:  Fri 17 Jan 2014 09:17:41 AM UTC
   
 
Category:  Octave Function Severity:  4 - Important
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 22 Jan 2014 06:39:28 PM UTC, comment #6: 

I tested and checked in the changes (http://hg.savannah.gnu.org/hgweb/octave/rev/b522d04382cf).  Closing report.

Rik <rik5>
Group administrator
Wed 22 Jan 2014 08:09:41 AM UTC, comment #5: 

It looks to me like the attached patch should fix it.  If you agree, apply it.  I don't need to be credited.

(file #30336)

John W. Eaton <jwe>
Group administrator
Fri 17 Jan 2014 05:21:16 PM UTC, comment #4: 

The problem bit of code is this section at line 557 of urlwrite.cc:


if (curl.good ())
  {
    if (nargout > 0)
      {
        // Return empty string if no error occured.
        retval(2) = curl.good () ? "" : curl.lasterror ();
        retval(1) = curl.good ();
        retval(0) = buf.str ();
      }
  }

if (nargout < 2 && ! curl.good ())
  error ("urlread: %s", curl.lasterror().c_str());


As you can see, if the curl call fails retval is not assigned to which leaves missing values for the second and third return arguments.  It looks pretty easy to fix, but I'm going to just add jwe to the CC list since he was the one who was changing this code back in October.

Rik <rik5>
Group administrator
Fri 17 Jan 2014 04:48:15 PM UTC, comment #3: 

Thanks, retitling and recategorizing to reflect that.

Mike Miller <mtmiller>
Group Member
Fri 17 Jan 2014 03:45:55 PM UTC, comment #2: 

You're right, it seems like a regression in urlread ().

Julien Bect <jbect>
Fri 17 Jan 2014 02:18:47 PM UTC, comment #1: 

This actually looks like a regression in the urlread function. If you agree with my diagnosis I'd rather retitle this bug to reflect that. The pkg function is using urlread and expecting it to return two return values. Observe in octave 3.6.4


octave-3.6.4:1> [a, b] = urlread ("http://octave.sourceforge.net/stats/index.html")
a =
b = 0


while in 3.8.0


octave-cli-3.8.0:1> [a, b] = urlread ("http://octave.sourceforge.net/stats/index.html")
error: element number 1 undefined in return list


If this is fixed, then you'll get this error message from pkg, which I do get in 3.6.4:


error: get_forge_pkg: package not found: "stats". Maybe you meant "communications?"


Mike Miller <mtmiller>
Group Member
Fri 17 Jan 2014 09:17:41 AM UTC, original submission:  

If I type the following:


pkg install -forge stats


I get:


error: element number 1 undefined in return list
error: called from:
error:   /usr/local/share/octave/4.1.0+/m/pkg/private/get_forge_pkg.m at line 40, column 14
error:   /usr/local/share/octave/4.1.0+/m/pkg/private/get_forge_download.m at line 26, column 12
error:   /usr/local/share/octave/4.1.0+/m/pkg/pkg.m at line 385, column 29


Of course, the problem is that I mistyped the package name, but the error message could certainly be a little clearer :)

Julien Bect <jbect>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #30336:  diffs.txt added by jwe (786B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jbect (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-22 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2014-01-22 jwe Attached File- Added diffs.txt, #30336
    2014-01-17 rik5 Carbon-Copy- Added jwe
    2014-01-17 mtmiller Severity3 - Normal 4 - Important
        Item GroupIncorrect Result Regression
        StatusNeed Info Confirmed
        Summarypkg should issue a clearer error message when the requested package is not found regression in urlread: second return value may be undefined
    2014-01-17 mtmiller Item GroupOther Incorrect Result
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code