bugGNU Octave - Bugs: bug #30652, Line numbers with warnings?


bug #30652: Line numbers with warnings?

Submitted by:  forkandwait <forkandwait>
Submitted on:  Wed 04 Aug 2010 11:13:11 PM UTC  
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Fork Open/Closed:  Closed
Release:  dev Operating System:  Microsoft Windows

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Sun 09 Feb 2014 10:52:57 PM UTC, comment #9: 

Felipe: I don't think Jordi was referring to this particular setting when he was referring to "stupid" cosmetic things. I suspect he was referring to things like fixed_point_format and struct_levels_to_print, which don't change behavior but only serve to make results harder to read.

I would certainly welcome some kind of discussion and come to a consensus agreement on what kinds of things should and should not be configured with the --traditional option. This bug report is probably not the place for that discussion, and since it is fixed for version 4.0, this bug should now be closed again.

Mike Miller <mtmiller>
Project Administrator
Sun 09 Feb 2014 10:51:50 PM UTC, comment #8: 

Rik: I see, you are right of course, I was testing with stable. This was fixed for the upcoming 4.0 release:


So yes, this is fixed.

Mike Miller <mtmiller>
Project Administrator
Sun 09 Feb 2014 10:40:27 PM UTC, comment #7: 

My point in comment #4 is that we already seem to be adding the line numbers to backtraces anyways.  I don't think we need to change any code at all as the option is already on by default for regular and --traditional users.

sh> octave -f
octave:1> myf = @(x) 1./ x;
octave:2> myf (0)
warning: division by zero
warning: called from
     at line -1 column -1
ans = Inf
octave:3> warning ("off", "backtrace")
octave:4> myf (0)
warning: division by zero
ans = Inf

Rik <rik5>
Project Administrator
Sun 09 Feb 2014 09:56:40 PM UTC, comment #6: 

there's no need to call any user's preferences stupid.
if this is going to be octave's default setting, fine.
otherwise, ex-matlab users would be pleased to have it.
the arguments against having this in --traditional
could equally be made against any of the other settings
currently existing in --traditional, such as:
  page_screen_output (false)
  print_empty_dimensions (false)
  struct_levels_to_print (0)
sure, every new user could rediscover these exist
and set heir own octaverc accordingly, but why
relegate only the unimportant stuff to --traditional?

Felipe G. Nievinski <fgnievinski>
Sun 09 Feb 2014 08:57:45 PM UTC, comment #5: 

That's what it looks like to me in the bug history as well. The point seemed to be made that if the user wants it, the preference is in place to set that, but it is not enabled by default. The user is expected to call

warning ("on", "backtrace")

in a personal or site octaverc file. Felipe's contribution is to want to enable this setting by default with --traditional, similar to how other variables are set to different defaults with --traditional. I'm not sure I agree with that approach, I've made the argument to him on other bugs that Octave is configurable and users should be able to set up octaverc files that set defaults and keybindings, and not defer to --traditional to set even more things to certain baked-in "braindead" defaults.

Mike Miller <mtmiller>
Project Administrator
Sun 09 Feb 2014 08:44:36 PM UTC, comment #4: 

The bug was closed because the original question had been addressed.  At any rate, I think Jordi is right that if we always want to enable backtrace for warnings then the fix doesn't belong in the option handler for '--traditional'.  It would need to be in the initialization routine for warning().  But, this seems to be the case already.  Take a look at error.cc where I find

// TRUE means that Octave will try to display a stack trace when a
// warning is encountered.
static bool Vbacktrace_on_warning = true;

Isn't Octave doing the right thing already?

Rik <rik5>
Project Administrator
Sun 09 Feb 2014 06:16:57 PM UTC, comment #3: 

I think you misunderstand the nature of --traditional. It is not a magical "make everything look like Matlab" feature. Normally, we are trying to make everything look like Matlab, even without --traditional. We only use it for cosmetic things that Matlab does that are just plain stupid, as many traditions are, and we don't typically want to emulate them. That's why "--braindead" is an alias to "--traditional".

In this case, this patch should probably always be enabled, since I agree that it's not very helpful to get warnings without immediately knowing where they're happening.

Also, why is this report closed? I'm reopening.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Fri 07 Feb 2014 09:53:04 PM UTC, comment #2: 

could you please apply the patch attached,
which enable such behavior be default on --traditional.

(file #30483)

Felipe G. Nievinski <fgnievinski>
Wed 11 Aug 2010 06:31:14 AM UTC, comment #1: 

Try warning("on", "backtrace").

Jaroslav Hajek <highegg>
Wed 04 Aug 2010 11:13:11 PM UTC, original submission:  

I often get this warning, and would like to know what line generates it:

"warning: implicit conversion from scalar to string"

I imagine it can use dbstack to gather the information, at least in an m-file?

forkandwait <forkandwait>


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

Attach Files:

Attached Files
file #30483:  octave.cc.diff added by fgnievinski (74B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by fgnievinski (Updated the item)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by highegg (Posted a comment)
  • -email is unavailable- added by forkandwait (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-09 mtmiller StatusNeed Info => Fixed
    2014-02-09 rik5 Open/ClosedOpen => Closed
    2014-02-09 rik5 StatusPatch Submitted => Need Info
    2014-02-09 jordigh StatusNone => Patch Submitted
        Open/ClosedClosed => Open
        Release3.2.4 => dev
    2014-02-07 fgnievinski Attached File- => Added octave.cc.diff, #30483
    2010-08-20 rik5 Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5