bugGNU Octave - Bugs: bug #33669, Test of get_first_help_sentence...

 
 

bug #33669: Test of get_first_help_sentence fails on MinGW

Submitter:  Tatsuro MATSUOKA <tmacchant>
Submitted:  Wed 29 Jun 2011 03:12:49 AM UTC
   
 
Category:  Interpreter Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 30 Nov 2011 12:07:09 AM UTC, comment #19: 

With the latest dev. source (after cb15c5185b6a ),

octave:1> test get_first_help_sentence
PASSES 7 out of 7 tests

The problem is now fixed so that this post can be closed.

Tatsuro MATSUOKA <tmacchant>
Tue 29 Nov 2011 09:48:09 AM UTC, comment #18: 

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/cb15c5185b6a

It seems to fix the problem for me with Octave cross-compiled for Windows using MinGW and tested with a copy of Windows 7 running in a virtual machine.  Let me know if the problem is not fixed for you.

John W. Eaton <jwe>
Group administrator
Mon 28 Nov 2011 11:32:52 PM UTC, comment #17: 

I have attached the patch (file #24480)


  scripts\help\get_first_help_sentence.m ................. PASS    6/7    FAIL 1



octave:1> test get_first_help_sentence
  ***** assert (strcmp (get_first_help_sentence('get_first_help_sentence'), "Return the first sentence of a function's help text."));
!!!!! test failed
assert (strcmp (get_first_help_sentence ('get_first_help_sentence'), "Return the first sentence of a function's help text.")) failed
octave:2> get_first_help_sentence ('get_first_help_sentence')
   Return the first sentence of a function's help text.


The situation is the same as that when  the previous patch (file #24431) is applied.

Tatsuro MATSUOKA <tmacchant>
Mon 28 Nov 2011 08:31:37 AM UTC, comment #16: 

OK, I'm attaching another patch, this time using mkostemp so that the mkstemp function can open files in binary mode.  Does this work?


(file #24480)

John W. Eaton <jwe>
Group administrator
Mon 28 Nov 2011 06:02:01 AM UTC, comment #15: 

Perhaps fdopen is not able to rebind a file from text mode to binary mode?  Some googling of the question didn't help much.  All of the documentation I can find says only that the mode in fdopen must be consistent with the mode used to open the original file.  So, if the original file was opened with append you can't rebind to just 'w'.

So, unfortunately the situation is back to using a hack in the .m file or integrating mkostemp from gnulib.

Rik <rik5>
Group administrator
Thu 24 Nov 2011 04:39:16 AM UTC, comment #14: 

I have attached the patch (file #24431)



diff -r c3c8f513cf1f -r 6c7130522baf src/file-io.cc
--- a/src/file-io.cc    Wed Nov 23 10:56:05 2011 -0800
+++ b/src/file-io.cc    Thu Nov 24 13:33:55 2011 +0900
@@ -2020,7 +2020,7 @@
             }
           else
             {
-              const char *fopen_mode = "w+";
+              const char *fopen_mode = "w+b";

               FILE *fid = fdopen (fd, fopen_mode);


The result is
  scripts\help\get_first_help_sentence.m ................. PASS    6/7    FAIL 1


octave:1> test get_first_help_sentence
  ***** assert (strcmp (get_first_help_sentence('get_first_help_sentence'), "Return the first sentence of a function's help text."));
!!!!! test failed
assert (strcmp (get_first_help_sentence ('get_first_help_sentence'), "Return the first sentence of a function's help text.")) failed
octave:2> get_first_help_sentence ('get_first_help_sentence')
   Return the first sentence of a function's help text.


Tatsuro MATSUOKA <tmacchant>
Wed 23 Nov 2011 06:56:42 AM UTC, comment #13: 

Looking at this now, I don't think we need to use mkostemp.  How about the attached change?  Does it solve the problem?  It simply adds "b" to the mode argument of the call to fdopen in the mkstemp function in file-io.cc.

(file #24431)

John W. Eaton <jwe>
Group administrator
Wed 23 Nov 2011 04:41:51 AM UTC, comment #12: 

Upgrading to blocker for 3.6.0 release.  Either the submitted patch should be applied or mkostemp should be used.  In either case this bug should be resolved and closed.

Rik <rik5>
Group administrator
Tue 04 Oct 2011 04:06:25 AM UTC, comment #11: 

I think I'd rather extend mkstemp to accept options, probably by using mkostemp internally.  Let me see if I can do that quickly.  If not, then I'll apply the other patch.

John W. Eaton <jwe>
Group administrator
Tue 04 Oct 2011 03:58:28 AM UTC, comment #10: 

It is natural the patch by Rik (file #24074) works for me.

Tatsuro MATSUOKA <tmacchant>
Sun 02 Oct 2011 06:07:27 AM UTC, comment #9: 

John,

I amended your patch so that it only applies to Windows systems and the other operating systems get to use a real mkstemp.  If you think it is fine then please commit it.

(file #24074)

Rik <rik5>
Group administrator
Wed 29 Jun 2011 09:31:20 PM UTC, comment #8: 

I applied your patch.


octave:1> a=get_first_help_sentence ('get_first_help_sentence')
a = Return the first sentence of a function's help text.
octave:2> b="Return the first sentence of a function's help text."
b = Return the first sentence of a function's help text.
octave:3> a==b
ans =

 Columns 1 through 49:

   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1

 Columns 50 through 52:

   1   1   1

octave:4> assert (strcmp (get_first_help_sentence('get_first_help_sentence'), "Return the first sentence of a function's help text."));


Problem seems to be fixed.

Thanks!

Please pushed patch to both the stable and development brances.

Tatsuro MATSUOKA <tmacchant>
Wed 29 Jun 2011 03:13:08 PM UTC, comment #7: 

Does the change attached in diffs-2.txt fix the problem for you?

I don't think this is the best fix, but if it works, I think I understand the problem, which is that mkstemp uses text mode to open files by default.  I guess we need to use mkostemp instead and specify the mode as binary.  But Octave doesn't currently have a binding for mkostemp.


(file #23587)

John W. Eaton <jwe>
Group administrator
Wed 29 Jun 2011 09:05:12 AM UTC, comment #6: 


>If you apply the attached patch, what is the output from running
>on your system?




octave:1> get_first_help_sentence ('get_first_help_sentence');
to_makeinfo =

 Columns 1 through 33:

    10    32    32    32    82   101   116   117   114   110    32   116   104   101    32   102   105   114   115   116    32   115   101   110   116   101   110    99   101    32   111   102    32

 Columns 34 through 66:

    97    32   102   117   110    99   116   105   111   110    39   115    32   104   101   108   112    32   116   101   120   116    46    10    10    32    84   104   101    32   102   105   114

 Columns 67 through 99:

   115   116    32   115   101   110   116   101   110    99   101    32   105   115    32   100   101   102   105   110   101   100    32    97   115    32   116   104   101    32   116   101   120

 Columns 100 through 132:

   116    32    97   102   116   101   114    32   116   104   101    32   102   117   110    99   116   105   111   110    10    32   100   101    99   108    97   114    97   116   105   111   110

 Columns 133 through 165:

    32   117   110   116   105   108    32   101   105   116   104   101   114    32   116   104   101    32   102   105   114   115   116    32   112   101   114   105   111   100    32    40    34

 Columns 166 through 198:

    46    34    41    32   111   114    32   116   104   101    32   102   105   114   115   116    32    97   112   112   101    97   114    97   110    99   101    32   111   102    10    32   116

 Columns 199 through 231:

   119   111    32    99   111   110   115   101    99   117   116   105   118   101    32   110   101   119   108   105   110   101   115    32    40    34    92   110    92   110    34    41    46

 Columns 232 through 250:

    32    32    84   104   101    32   116   101   120   116    32   105   115    32   116   114   117   110    99

from_makeinfo =

 Columns 1 through 33:

    13    32    13    32    32    32    82   101   116   117   114   110    32   116   104   101    32   102   105   114   115   116    32   115   101   110   116   101   110    99   101    32   111

 Columns 34 through 66:

   102    32    97    32   102   117   110    99   116   105   111   110    39   115    32   104   101   108   112    32   116   101   120   116    46    13    32    13    32    84   104   101    10

 Columns 67 through 99:

   102   105   114   115   116    32   115   101   110   116   101   110    99   101    32   105   115    32   100   101   102   105   110   101   100    32    97   115    32   116   104   101    32

 Columns 100 through 132:

   116   101   120   116    32    97   102   116   101   114    32   116   104   101    32   102   117   110    99   116   105   111   110    13    32   100   101    99   108    97   114    97   116

 Columns 133 through 165:

   105   111   110    10   117   110   116   105   108    32   101   105   116   104   101   114    32   116   104   101    32   102   105   114   115   116    32   112   101   114   105   111   100

 Columns 166 through 198:

    32    40    34    46    34    41    32   111   114    32   116   104   101    32   102   105   114   115   116    32    97   112   112   101    97   114    97   110    99   101    32   111   102

 Columns 199 through 231:

    13    32   116   119   111    10    99   111   110   115   101    99   117   116   105   118   101    32   110   101   119   108   105   110   101   115    32    40    34    92   110    92   110

 Columns 232 through 250:

    34    41    46    32    32    84   104   101    32   116   101   120   116    32   105   115    32   116   114




Tatsuro MATSUOKA <tmacchant>
Wed 29 Jun 2011 04:51:27 AM UTC, comment #5: 

That looks normal, with no CR characters.  So how do they get added?

If you apply the attached patch, what is the output from running


get_first_help_sentence ('get_first_help_sentence');


on your system?

(file #23586)

John W. Eaton <jwe>
Group administrator
Wed 29 Jun 2011 04:42:40 AM UTC, comment #4: 


>What is the output of
>[ht, fmt] = get_help_text ('get_first_help_sentence');
>toascii (ht(1:250))
>on your system?


The result is


octave:4> [ht, fmt] = get_help_text ('get_first_help_sentence');
octave:5> toascii (ht(1:250))
ans =

 Columns 1 through 33:

    10    32    64   100   101   102   116   121   112   101   102   110    32    32   123    70   117   110    99   116   105   111   110    32    70   105   108   101   125    32   123    91    64

 Columns 34 through 66:

   118    97   114   123   116   101   120   116   125    44    32    64   118    97   114   123   115   116    97   116   117   115   125    93    32    61   125    32   103   101   116    95   102

 Columns 67 through 99:

   105   114   115   116    95   104   101   108   112    95   115   101   110   116   101   110    99   101    32    40    64   118    97   114   123   110    97   109   101   125    41    10    32

 Columns 100 through 132:

    64   100   101   102   116   121   112   101   102   110   120    32   123    70   117   110    99   116   105   111   110    32    70   105   108   101   125    32   123    91    64   118    97

 Columns 133 through 165:

   114   123   116   101   120   116   125    44    32    64   118    97   114   123   115   116    97   116   117   115   125    93    32    61   125    32   103   101   116    95   102   105   114

 Columns 166 through 198:

   115   116    95   104   101   108   112    95   115   101   110   116   101   110    99   101    32    40    64   118    97   114   123   110    97   109   101   125    44    32    64   118    97

 Columns 199 through 231:

   114   123   109    97   120    95   108   101   110   125    41    10    32    82   101   116   117   114   110    32   116   104   101    32   102   105   114   115   116    32   115   101   110

 Columns 232 through 250:

   116   101   110    99   101    32   111   102    32    97    32   102   117   110    99   116   105   111   110


Tatsuro MATSUOKA <tmacchant>
Wed 29 Jun 2011 04:26:10 AM UTC, comment #3: 

OK, so the first six characters are a combination of CR and SPC, so I guess we are not handling CR somewhere that we should.  I tried adding CR to the ends of the lines of a function file on my system but I don't see this result.

What is the output of


[ht, fmt] = get_help_text ('get_first_help_sentence');
toascii (ht(1:250)


on your system?

John W. Eaton <jwe>
Group administrator
Wed 29 Jun 2011 04:12:56 AM UTC, comment #2: 

Thanks for your reply.


>It looks like you have some extra space at the beginning of the line.
>What is the output of
>toascii (get_first_help_sentence ('get_first_help_sentence'))
>on your system?


The below is the result



octave:1> toascii (get_first_help_sentence ('get_first_help_sentence'))
ans =

 Columns 1 through 33:

    13    32    13    32    32    32    82   101   116   117   114   110    32   116   104   101    32   102   105   114   115   116    32   115   101   110   116   101   110    99   101    32   111

 Columns 34 through 58:

   102    32    97    32   102   117   110    99   116   105   111   110    39   115    32   104   101   108   112    32   116   101   120   116    46


Tatsuro MATSUOKA <tmacchant>
Wed 29 Jun 2011 03:52:12 AM UTC, comment #1: 

It looks like you have some extra space at the beginning of the line.

What is the output of


toascii (get_first_help_sentence ('get_first_help_sentence'))


on your system?

John W. Eaton <jwe>
Group administrator
Wed 29 Jun 2011 03:12:49 AM UTC, original submission:  

Test of get_first_help_sentence fails on MinGW.


>>>>> processing e:\usr\Tatsu\mingwhome\octaves\hg\octave-work\scripts/help\get_first_help_sentence.m
  ***** assert (strcmp (get_first_help_sentence('get_first_help_sentence'), "Return the first sentence of a function's help text."));
!!!!! test failed
assert (strcmp (get_first_help_sentence ('get_first_help_sentence'), "Return the first sentence of a function's help text.")) failed



octave:1> a=get_first_help_sentence ('get_first_help_sentence')
   Return the first sentence of a function's help text.
octave:2> b="Return the first sentence of a function's help text."
b = Return the first sentence of a function's help text.
octave:4> [txt,st]=get_first_help_sentence('get_first_help_sentence')
   Return the first sentence of a function's help text.
st = 0


get_first_help_sentence('get_first_help_sentence') seems not to return simple strings. Am I right?

Tatsuro MATSUOKA <tmacchant>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #24480:  diffs-4.txt added by jwe (2KiB - text/plain)
file #24431:  diffs-3.txt added by jwe (304B - text/plain)
file #24074:  firsthelp.patch added by rik5 (1KiB - text/x-diff)
file #23587:  diffs-2.txt added by jwe (468B - text/plain)
file #23586:  diffs.txt added by jwe (556B - text/plain)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

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

    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 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-29 jwe StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2011-11-28 jwe Attached File- Added diffs-4.txt, #24480
    2011-11-23 jwe Attached File- Added diffs-3.txt, #24431
    2011-11-23 rik5 Severity3 - Normal 5 - Blocker
    2011-10-03 rik5 Dependencies- bugs #34280 is dependent
    2011-10-02 rik5 Attached File- Added firsthelp.patch, #24074
        StatusNeed Info Patch Submitted
    2011-06-29 jwe Attached File- Added diffs-2.txt, #23587
    2011-06-29 jwe Attached File- Added diffs.txt, #23586
    2011-06-29 jwe StatusNone Need Info
    2011-06-29 tmacchant Carbon-Copy- Added "benjamin lindner" <bjmldn@gmail.com>

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code