bugGNU Octave - Bugs: bug #63462, sscanf reports incorrect number of...

 
 

bug #63462: sscanf reports incorrect number of output values.

Submitter:  None
Submitted:  Sat 03 Dec 2022 03:58:03 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Works For Me Assigned to:  None
Originator Name:  Reinhard Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 09 Dec 2022 09:08:52 PM UTC, comment #19: 

It seems that the true issue is something else. At several locations in Octave's code, the stream state is reset and the eof bit is cleared. See lo-utils.cc:329 for example.

            // True error.
            // Reset stream to original position, clear eof bit, pass status on.
            is.clear ();
            is.seekg (pos);
            is.setstate (status & ~std::ios_base::eofbit);

So, whenever Octave encounters an eof condition and does not handle it properly, the same text may be parsed again and again. As a consequence, the last value in the string may be duplicated if the end of the string is reached.

Anonymous
Fri 09 Dec 2022 01:10:04 AM UTC, comment #18: 

I think this may be related to underlying behavior of '>>' operator or 'peek()' function with the particular version of C++.  With my version of libstdc++ I believe the failbit and the eofbit get set when reading touches the EOF.

Nevertheless, the patch appears reasonable. For consistency, it should be duplicated across the other calls to "if (octave_scan (...))" in that switch block.

Rik <rik5>
Group administrator
Thu 08 Dec 2022 10:33:02 AM UTC, comment #17: 

According to https://en.cppreference.com/w/cpp/io/basic_ios/operator_bool, basic_ios::operator bool() does not check for eof(). See the attached file.


Anonymous
Thu 08 Dec 2022 10:18:14 AM UTC, comment #16: 

I don't know exactly why, but it seems that the following patch fixes the issue:

diff -r b69d89906ae9 libinterp/corefcn/oct-stream.cc
--- a/libinterp/corefcn/oct-stream.cc        Sat Dec 03 14:45:33 2022 -0500
+++ b/libinterp/corefcn/oct-stream.cc        Thu Dec 08 11:10:52 2022 +0100
@@ -5314,7 +5314,7 @@
           {
             double tmp;

-            if (octave_scan (is, *elt, &tmp))
+            if (octave_scan (is, *elt, &tmp).good())
               {
                 if (! discard)
                   retval = tmp;


When applying the patch, I get this output:

[a,b,c,d,cnt]=sscanf("1 abcdefg 1.5\n","%d %s %g %g","C")
a = 1
b = abcdefg
c = 1.5000
d = [](0x0)
cnt = 3


(file #54069)

Anonymous
Tue 06 Dec 2022 09:43:07 PM UTC, comment #15: 

If working in a build directory, you must use "run-octave" script. 

However, it might be easier to do "make install" and test that binary itself by using "/path/to/binary/octave".  Also "ldd" will run correctly on the installed binary, but not on the file "src/.libs/octave-cli".  To run "ldd" in the build directory would require


./libtool --mode=execute ldd src/octave-cli


Rik <rik5>
Group administrator
Mon 05 Dec 2022 08:44:14 PM UTC, comment #14: 

You should NOT run ./src/.libs/octave-cli (nor ./src/.libs/octave-gui),
but ./run-octave script in the build directory.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 05 Dec 2022 08:33:22 PM UTC, comment #13: 

I tried to install it and also to run ./src/.libs/octave-cli but it is still the same issue.

Then I tried to debug it and it seems that the problem happens somewhere in oct-stream.cc:5424

      int num_values = 0;

      bool quit = false;

      for (octave_idx_type i = 0; i < len; i++)
        {
          octave_value tmp;

          quit = do_oscanf (elt, tmp, who);

          if (quit)
            break;
          else
            {
              if (tmp.is_defined ())
                retval(num_values++) = tmp;

              if (! ok ())
                break;

              elt = fmt_list.next (m_nconv > 0);
            }
        }


For whatever reason, the quit flag is not set and the code is filling the retval array with the last value which was converted successful.

Anonymous
Mon 05 Dec 2022 01:02:55 AM UTC, comment #12: 

I think his configure says "Ubuntu 20.04".

ldd output on fedora is equally longish:

$ ldd src/.libs/octave-gui
        linux-vdso.so.1 (0x00007ffe1b5ae000)
        liboctgui.so.8 => /usr/lib64/octave/7.2.0/liboctgui.so.8 (0x00007f0d76600000)
        liboctinterp.so.10 => /usr/lib64/octave/7.2.0/liboctinterp.so.10 (0x00007f0d75200000)
        libQt5Help.so.5 => /lib64/libQt5Help.so.5 (0x00007f0d76bda000)
        libQt5Sql.so.5 => /lib64/libQt5Sql.so.5 (0x00007f0d76b93000)
        libQt5Network.so.5 => /lib64/libQt5Network.so.5 (0x00007f0d76448000)
        libQt5PrintSupport.so.5 => /lib64/libQt5PrintSupport.so.5 (0x00007f0d76b17000)
        libQt5Xml.so.5 => /lib64/libQt5Xml.so.5 (0x00007f0d76acf000)
        libqscintilla2_qt5.so.15 => /lib64/libqscintilla2_qt5.so.15 (0x00007f0d74e00000)
        libQt5OpenGL.so.5 => /lib64/libQt5OpenGL.so.5 (0x00007f0d76a6e000)
        libQt5Widgets.so.5 => /lib64/libQt5Widgets.so.5 (0x00007f0d74600000)
        libQt5Gui.so.5 => /lib64/libQt5Gui.so.5 (0x00007f0d73e00000)
        libQt5Core.so.5 => /lib64/libQt5Core.so.5 (0x00007f0d73800000)
        liboctave.so.9 => /usr/lib64/octave/7.2.0/liboctave.so.9 (0x00007f0d72a00000)
        libhdf5.so.200 => /lib64/libhdf5.so.200 (0x00007f0d72400000)
        libGraphicsMagick++-Q16.so.12 => /lib64/libGraphicsMagick++-Q16.so.12 (0x00007f0d75182000)
        libGraphicsMagick-Q16.so.3 => /lib64/libGraphicsMagick-Q16.so.3 (0x00007f0d72835000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f0d7642e000)
        libGL.so.1 => /lib64/libGL.so.1 (0x00007f0d750fb000)
        libGLU.so.1 => /lib64/libGLU.so.1 (0x00007f0d74da7000)
        libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f0d74d58000)
        libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f0d74532000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007f0d722b9000)
        libgl2ps.so.1 => /lib64/libgl2ps.so.1 (0x00007f0d750e1000)
        libcurl.so.4 => /lib64/libcurl.so.4 (0x00007f0d744b0000)
        libcholmod.so.3 => /lib64/libcholmod.so.3 (0x00007f0d721b9000)
        libumfpack.so.5 => /lib64/libumfpack.so.5 (0x00007f0d73735000)
        libamd.so.2 => /lib64/libamd.so.2 (0x00007f0d750d4000)
        libcamd.so.2 => /lib64/libcamd.so.2 (0x00007f0d750c6000)
        libcolamd.so.2 => /lib64/libcolamd.so.2 (0x00007f0d76a5f000)
        libccolamd.so.2 => /lib64/libccolamd.so.2 (0x00007f0d750b8000)
        libcxsparse.so.3 => /lib64/libcxsparse.so.3 (0x00007f0d74d21000)
        libsuitesparseconfig.so.5 => /lib64/libsuitesparseconfig.so.5 (0x00007f0d76429000)
        libspqr.so.2 => /lib64/libspqr.so.2 (0x00007f0d74478000)
        libarpack.so.2 => /lib64/libarpack.so.2 (0x00007f0d73db3000)
        libqrupdate.so.1 => /lib64/libqrupdate.so.1 (0x00007f0d7444e000)
        libfftw3_threads.so.3 => /lib64/libfftw3_threads.so.3 (0x00007f0d74d17000)
        libfftw3.so.3 => /lib64/libfftw3.so.3 (0x00007f0d71fc5000)
        libfftw3f_threads.so.3 => /lib64/libfftw3f_threads.so.3 (0x00007f0d74d0d000)
        libfftw3f.so.3 => /lib64/libfftw3f.so.3 (0x00007f0d71c00000)
        libflexiblas.so.3 => /lib64/libflexiblas.so.3 (0x00007f0d71800000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f0d71f28000)
        libgfortran.so.5 => /lib64/libgfortran.so.5 (0x00007f0d71400000)
        libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f0d71ee0000)
        libreadline.so.8 => /lib64/libreadline.so.8 (0x00007f0d71e85000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f0d71000000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f0d71720000)
        libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f0d71e3b000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0d73d93000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f0d70e23000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f0d713a9000)
        libssl.so.3 => /lib64/libssl.so.3 (0x00007f0d71306000)
        libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007f0d70800000)
        libpng16.so.16 => /lib64/libpng16.so.16 (0x00007f0d71e01000)
        libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x00007f0d70d37000)
        libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007f0d70c5a000)
        libicui18n.so.71 => /lib64/libicui18n.so.71 (0x00007f0d70400000)
        libicuuc.so.71 => /lib64/libicuuc.so.71 (0x00007f0d70203000)
        libpcre2-16.so.0 => /lib64/libpcre2-16.so.0 (0x00007f0d71278000)
        libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f0d7074d000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f0d700c3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0d76c67000)
        libncurses.so.6 => /lib64/libncurses.so.6 (0x00007f0d72808000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f0d71bcd000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f0d70049000)
        libsz.so.2 => /lib64/libsz.so.2 (0x00007f0d74441000)
        liblcms2.so.2 => /lib64/liblcms2.so.2 (0x00007f0d6ffe2000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007f0d73d7e000)
        libSM.so.6 => /lib64/libSM.so.6 (0x00007f0d7372a000)
        libICE.so.6 => /lib64/libICE.so.6 (0x00007f0d7370c000)
        libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f0d71bba000)
        libltdl.so.7 => /lib64/libltdl.so.7 (0x00007f0d71714000)
        libGLX.so.0 => /lib64/libGLX.so.0 (0x00007f0d716e2000)
        libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007f0d6ff29000)
        libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f0d6fdaf000)
        libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007f0d716d5000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f0d7124d000)
        libnghttp2.so.14 => /lib64/libnghttp2.so.14 (0x00007f0d70c2f000)
        libidn2.so.0 => /lib64/libidn2.so.0 (0x00007f0d6fd62000)
        libtbb.so.2 => /lib64/libtbb.so.2 (0x00007f0d6fd1e000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f0d6fc41000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f0d71234000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f0d72801000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f0d7073c000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f0d71bb3000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f0d6fc2e000)
        libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007f0d6fc0c000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f0d70732000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f0d6fbe1000)
        liblz4.so.1 => /lib64/liblz4.so.1 (0x00007f0d6fbbd000)
        libicudata.so.71 => /lib64/libicudata.so.71 (0x00007f0d6de00000)
        libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f0d6fbb4000)
        libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007f0d6fb91000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007f0d716cd000)
        libunistring.so.2 => /lib64/libunistring.so.2 (0x00007f0d6dc48000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f0d6fb64000)


ldd picking up some installed libraries should not be a problem per jwe
(https://octave.discourse.group/t/bump-soname-number-for-liboctinterp-so-and-liboctave-so/3639):


I don’t think there is a problem with the library version when running Octave in the build directory if you use the run-octave script. It uses libtool to execute Octave and should be correctly setting up the necessary environment to use the library files in the build directory tree.


But perhaps OP runs ./src/.libs/octave-cli directly?

Dmitri.
--



Dmitri A. Sergatskov <dasergatskov>
Mon 05 Dec 2022 12:49:10 AM UTC, comment #11: 

I believe the PCRE linkage question is a red herring.  The code for scanf relies on Octave hand-rolled code as well as the C/C++ standard library, but not on regular expressions.  However, the linkage question should be investigated and probably deserves its own bug report.

Also, the decimal format "%d" uses a different code path than the code for floating point values ("%f", "%g") so this, unfortunately, doesn't help narrow things down.

The system seems to be fairly generic Linux, X86_64 and 5.4 kernel.  The gcc is version 9.4.0 while mine 11.2.  Maybe there is a bug reported against libstdc++ for this version?

This could be hard to debug.

I notice from the config.log that you are setting some compilation flags to point to "/usr/local/XXX" versions. 


  $ ../octave/configure --prefix=/opt/octave-default LDFLAGS=-L/usr/local/lib -Wl,-rpath=/usr/local/lib CPPFLAGS=-I/usr/local/include --with-umfpack-includedir=/usr/local/include --with-umfpack-libdir=/usr/local/lib


This shouldn't be a problem, but I don't do that for my compilation so that is one difference.  Is it possible that you are picking up some different versions of libraries in /usr/local/lib?

Another thing is that my ldd output is much smaller. My output is


ldd src/.libs/octave-gui
        linux-vdso.so.1 (0x00007ffebadfd000)
        liboctgui.so.8 => not found
        liboctinterp.so.10 => not found
        liboctave.so.9 => not found
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f39887f1000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f39887d1000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f39885a7000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f39884c0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3988a43000)


By contrast, your setup seems to be picking up some installed libraries


       liboctgui.so.8 => /opt/octave-default/lib/octave/9.0.0/liboctgui.so.8 (0x00007f238063e000)
        liboctinterp.so.10 => /opt/octave-default/lib/octave/9.0.0/liboctinterp.so.10 (0x00007f237f1b8000)
        liboctave.so.9 => /opt/octave-default/lib/octave/9.0.0/liboctave.so.9 (0x00007f237dffa000)


Grasping at straws here, but maybe you need to do "make install" to replace existing versions of Octave libraries on the hard drive which still have the bug in them.

Rik <rik5>
Group administrator
Sun 04 Dec 2022 08:20:15 PM UTC, comment #10: 

I see that ldd returns libpcre2-16 that is for handling utf-16
(also the config found libpcre2-8).
So you probably still using old libpcre, which should not be a problem though.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 04 Dec 2022 08:04:47 PM UTC, comment #9: 

Now compiled with libpcre2, although libpcre is still used.

ldd src/.libs/octave-gui
        linux-vdso.so.1 (0x00007ffe865ed000)
        liboctgui.so.8 => /opt/octave-default/lib/octave/9.0.0/liboctgui.so.8 (0x00007f238063e000)
        liboctinterp.so.10 => /opt/octave-default/lib/octave/9.0.0/liboctinterp.so.10 (0x00007f237f1b8000)
        liboctave.so.9 => /opt/octave-default/lib/octave/9.0.0/liboctave.so.9 (0x00007f237dffa000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f237ddf1000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f237ddd6000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f237dbe4000)
        libQt5Help.so.5 => /lib/x86_64-linux-gnu/libQt5Help.so.5 (0x00007f237db69000)
        libQt5Network.so.5 => /lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007f237d9a8000)
        libQt5PrintSupport.so.5 => /lib/x86_64-linux-gnu/libQt5PrintSupport.so.5 (0x00007f237d92f000)
        libqscintilla2_qt5.so.15 => /lib/libqscintilla2_qt5.so.15 (0x00007f237d2f3000)
        libQt5Widgets.so.5 => /lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007f237cc58000)
        libQt5Gui.so.5 => /lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007f237c66d000)
        libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f237c122000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f237c11d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f237bfce000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f237bfab000)
        libhdf5_serial.so.103 => /lib/x86_64-linux-gnu/libhdf5_serial.so.103 (0x00007f237bc2e000)
        libGraphicsMagick++-Q16.so.12 => /lib/libGraphicsMagick++-Q16.so.12 (0x00007f237bbbc000)
        libGraphicsMagick-Q16.so.3 => /lib/libGraphicsMagick-Q16.so.3 (0x00007f237b8d7000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f237b8bb000)
        libcholmod.so.3 => /usr/local/lib/libcholmod.so.3 (0x00007f237b7ac000)
        libamd.so.2 => /usr/local/lib/libamd.so.2 (0x00007f237b79f000)
        libcolamd.so.2 => /usr/local/lib/libcolamd.so.2 (0x00007f237b795000)
        libccolamd.so.2 => /usr/local/lib/libccolamd.so.2 (0x00007f237b787000)
        libcxsparse.so.3 => /usr/local/lib/libcxsparse.so.3 (0x00007f237b750000)
        libsuitesparseconfig.so.5 => /usr/local/lib/libsuitesparseconfig.so.5 (0x00007f237b74b000)
        libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f237b6c3000)
        libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007f237b651000)
        libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f237b60a000)
        libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f237b54b000)
        libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f237b40c000)
        libgl2ps.so.1.4 => /lib/x86_64-linux-gnu/libgl2ps.so.1.4 (0x00007f237b1f7000)
        libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f237b1b5000)
        libcurl-gnutls.so.4 => /lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f237b125000)
        libumfpack.so.5 => /usr/local/lib/libumfpack.so.5 (0x00007f237b05c000)
        libspqr.so.2 => /usr/local/lib/libspqr.so.2 (0x00007f237b027000)
        libarpack.so.2 => /lib/x86_64-linux-gnu/libarpack.so.2 (0x00007f237afdd000)
        libqrupdate.so.1 => /lib/x86_64-linux-gnu/libqrupdate.so.1 (0x00007f237afc3000)
        libfftw3_threads.so.3 => /lib/x86_64-linux-gnu/libfftw3_threads.so.3 (0x00007f237afb9000)
        libfftw3.so.3 => /lib/x86_64-linux-gnu/libfftw3.so.3 (0x00007f237adb3000)
        libfftw3f_threads.so.3 => /lib/x86_64-linux-gnu/libfftw3f_threads.so.3 (0x00007f237ada9000)
        libfftw3f.so.3 => /lib/x86_64-linux-gnu/libfftw3f.so.3 (0x00007f237ab99000)
        libopenblas.so.0 => /usr/local/lib/libopenblas.so.0 (0x00007f2379ff3000)
        libreadline.so.8 => /lib/x86_64-linux-gnu/libreadline.so.8 (0x00007f2379fa3000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f2379f30000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2379f2a000)
        libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f2379c62000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2380a9f000)
        libQt5Sql.so.5 => /lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007f2379c12000)
        libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f2379bda000)
        libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007f2379ad6000)
        libicui18n.so.66 => /lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007f23797d7000)
        libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007f23795f1000)
        libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007f237956b000)
        libdouble-conversion.so.3 => /lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x00007f2379555000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f237942c000)
        libsz.so.2 => /lib/x86_64-linux-gnu/libsz.so.2 (0x00007f2379427000)
        libjbig.so.0 => /lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f2379416000)
        libwebp.so.6 => /lib/x86_64-linux-gnu/libwebp.so.6 (0x00007f23793aa000)
        libwebpmux.so.3 => /lib/x86_64-linux-gnu/libwebpmux.so.3 (0x00007f237939e000)
        liblcms2.so.2 => /lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f2379343000)
        libtiff.so.5 => /lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f23792c2000)
        libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f237923d000)
        libwmflite-0.2.so.7 => /lib/x86_64-linux-gnu/libwmflite-0.2.so.7 (0x00007f237921c000)
        libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f2379205000)
        libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f23791f2000)
        libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f2379038000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f2378f8f000)
        libcamd.so.2 => /usr/local/lib/libcamd.so.2 (0x00007f2378f81000)
        libmetis.so => /usr/local/lib/libmetis.so (0x00007f2378f10000)
        libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f2378e56000)
        libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f2378e22000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f2378df4000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f2378deb000)
        libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f2378dc1000)
        libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007f2378d96000)
        libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f2378d75000)
        librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f2378d55000)
        libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007f2378ce7000)
        libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007f2378cd4000)
        libnettle.so.7 => /lib/x86_64-linux-gnu/libnettle.so.7 (0x00007f2378c9a000)
        libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f2378ac2000)
        libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f2378a75000)
        libldap_r-2.4.so.2 => /lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f2378a1f000)
        liblber-2.4.so.2 => /lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f2378a0e000)
        libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007f2378a00000)
        libtbb.so.2 => /lib/x86_64-linux-gnu/libtbb.so.2 (0x00007f23789b8000)
        liblapack.so.3 => /lib/x86_64-linux-gnu/liblapack.so.3 (0x00007f23769a4000)
        libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x00007f2374fa5000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f2374f75000)
        libquadmath.so.0 => /lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f2374f2b000)
        libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007f2374efe000)
        libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007f237343b000)
        libaec.so.0 => /lib/x86_64-linux-gnu/libaec.so.0 (0x00007f2373432000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f2373409000)
        libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f2373403000)
        libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f23733fb000)
        libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f2373277000)
        libhogweed.so.5 => /lib/x86_64-linux-gnu/libhogweed.so.5 (0x00007f2373240000)
        libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f23731bc000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f2372ee6000)
        libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f2372db0000)
        libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f2372d98000)
        libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f2372cbb000)
        libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f2372c8a000)
        libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f2372c83000)
        libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f2372c74000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f2372c58000)
        libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f2372c39000)
        libgssapi.so.3 => /lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f2372bf4000)
        libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007f2372bd1000)
        libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f2372bb7000)
        libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007f2372bab000)
        libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f2372ba2000)
        libheimntlm.so.0 => /lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f2372b96000)
        libkrb5.so.26 => /lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f2372b03000)
        libasn1.so.8 => /lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f2372a5c000)
        libhcrypto.so.4 => /lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f2372a24000)
        libroken.so.18 => /lib/x86_64-linux-gnu/libroken.so.18 (0x00007f2372a09000)
        libwind.so.0 => /lib/x86_64-linux-gnu/libwind.so.0 (0x00007f23729df000)
        libheimbase.so.1 => /lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f23729cd000)
        libhx509.so.5 => /lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f237297f000)
        libsqlite3.so.0 => /lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f2372856000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f237281b000)


(file #54056)

Anonymous
Sun 04 Dec 2022 07:28:26 PM UTC, comment #8: 

The only thing I noticed that you are are using pcre rather than pcre2.
I tried to rebuild with pcre, but pcre2 got linked in anyway though some other libraries. So it is not a clean test.
Could perhaps rebuild against pcre2? You may need to install
libpcre2-dev for that.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 04 Dec 2022 07:06:47 PM UTC, comment #7: 

You may want to gzip it.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 04 Dec 2022 07:05:34 PM UTC, comment #6: 

I'm attaching the config.log.

Anonymous
Sun 04 Dec 2022 06:42:01 PM UTC, comment #5: 

Please provide us info about your system. What is an CPU, OS, compiler, glibc versions?

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 04 Dec 2022 06:24:30 PM UTC, comment #4: 

After recompilation of the default branch, there is still the same issue:

[a,b,c,d,cnt, err]=sscanf("1 abcdefg 3\n","%d %s %g %g","C")
a = 1
b = abcdefg
c = 3
d = 3
cnt = 4
err =
octave:10> version -hgid
ans = b69d89906ae9


However, if I use %d instead of %g, the output is correct.

[a,b,c,d,cnt, err]=sscanf("1 abcdefg 3\n","%d %s %d %d","C")
a = 1
b = abcdefg
c = 3
d = [](0x0)
cnt = 3
err = %s: read error: sscanf


Anonymous
Sun 04 Dec 2022 12:30:19 PM UTC, comment #3: 

The plus "+" at the end of the hg id string indicates that you have
local modifications to the sources. Please undo them and repeat the test.
To be sure I would recommend to re-clone.


octave:1> [a,b,c,d,cnt, err]=sscanf("1 abcdefg 3\n","%d %s %g %g","C")
a = 1
b = abcdefg
c = 3
d = [](0x0)
cnt = 3
err = %s: read error: sscanf
octave:2> version -hgid
ans = b69d89906ae9


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sun 04 Dec 2022 11:25:15 AM UTC, comment #2: 

With octave-8.0.1 the output of sscanf is correct. The issue appears only in version 9.0.0 with this hgid:

version -hgid
ans = 1e270beb6982+


Anonymous
Sat 03 Dec 2022 06:18:51 PM UTC, comment #1: 

There has been massive re-factoring of scanf code so I'm not surprised new issues have arisen.  However, the code works for me.  This is with hg id 4c040e1edb4b.

Test code:


[a,b,c,d,cnt, err]=sscanf("1 abcdefg 3\n","%d %s %g %g","C")

a = 1
b = abcdefg
c = 3
d = [](0x0)
cnt = 3
err = %s: read error: sscanf



Rik <rik5>
Group administrator
Sat 03 Dec 2022 03:58:03 PM UTC, original submission:  

If you run this code in octave-9.0.0

[a,b,c,d,n]=sscanf("1 abcdefg 3\n","%d %s %g %g","C")

you get

a = 1
b = abcdefg
c = 3
d = 3
n = 4


In octave-6.4.0 the output was

a = 1
b = abcdefg
c = 3
d = [](0x0)
n = 3


So, with octave-9.0.0 incorrectly reported four values instead of three.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54069:  oct-stream.patch added by None (436B - text/x-patch)
file #54056:  config.tar.bz2 added by None (102KiB - application/x-bzip)
file #54055:  config.tar.bz2 added by None (103KiB - application/x-bzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-08 None Attached File- Added Screenshot@from@2022-12-08@11-31-19.png, #54070
    2022-12-08 None Attached File- Added oct-stream.patch, #54069
    2022-12-04 None Attached File- Added config.tar.bz2, #54056
    2022-12-04 None Attached File- Added config.tar.bz2, #54055
    2022-12-03 rik5 StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code