Control: reopen -1
Control: tags -1 + upstream
Control: forwarded -1 https://savannah.gnu.org/bugs/index.php?67043

* Francesco Potortì <poto...@isti.cnr.it> [2025-04-22 18:06]:

The behavior of unlink and many other functions has been changed in version 7.0 of Octave. This is well documented. Here is an excerpt of the file etc/NEWS.7.md:

There are two documentation issues here.  First, this is not what the manual 
says:

-- : unlink (FILE) -- : [STATUS, MSG] = unlink (FILE) Delete the file named FILE.

    If successful, STATUS is 0 and MSG is an empty string.  Otherwise,
    STATUS is -1 and MSG contains a system-dependent error message.

    See also: *note delete: XREFdelete, *note rmdir: XREFrmdir.

As you can see, nowhere is it mentioned that unlink may throw an error when called without a return value.

Fair enough. I am hereby reopening this bug report. Indeed, the help documentation is incomplete.

Moreover, the NEWS file that you cited mentions a difference in command form versus functional form, but that is not the issue. In fact, my old program uses a functional form, and yet:

octave> unlink("nonexistent_file") error: unlink: operation failed: No such file or directory

So both the manual and the NEWS file need to be corrected and should state that unlink (and others) may throw an error unless they are called with at least one return value.

Indeed, the documentation in NEWS.7.md is not perfect. It assumes that when using the functional form, the user *always* collect the status in an output variable.

I forwarded this bug report upstream.

Thanks,

Rafael Laboissière

Reply via email to