bugGNU Octave - Bugs: bug #49628, copyfile fails to copy source...

 
 

bug #49628: copyfile fails to copy source files with [ or ] characters in the name

Submitter:  Richard Suchland <suchland>
Submitted:  Wed 16 Nov 2016 09:42:10 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
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

Sun 24 Jan 2021 09:14:59 AM UTC, comment #6: 

Seems to work for me now on Windows.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Fri 22 Jan 2021 04:16:52 PM UTC, comment #5: 

Looks like most of this was "accidentally" fixed as a collateral for bug #59287:
https://hg.savannah.gnu.org/hgweb/octave/rev/1c212b36a35e

From the list that Rik posted in comment #3, I missed:
delete.m
pkg/private/install.m

I pushed a change for those here:
https://hg.savannah.gnu.org/hgweb/octave/rev/0fb5ba41a12a

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Thu 17 Nov 2016 04:48:52 AM UTC, comment #4: 

Oh, sure enough, I forgot that this was only fixed for the dir functions, and not for every function that calls glob, which I now remember the explicit reasons for. So yeah maybe we should do this for every function that can operate on wildcard patterns, where the user is expecting to be able to use Windows wildcards and not the extended POSIX glob wildcard characters.

Mike Miller <mtmiller>
Group Member
Thu 17 Nov 2016 04:00:39 AM UTC, comment #3: 

This was solved for dir.m by introducing a new C++ function _wglob_ which performs a Windows-like glob.  The same issue came up ot bug #47950, to wit, should we have glob be system-dependent or not?  If not, then you can solve this by having code in each and every m-file that checks for ispc() and ! isunix() and then calls _wglob_ or glob appropriately.

Affected functions are:

copyfile
delete
fileattrib
movefile
unpack
pkg/private/install.m
pkg/private/rebuild.m

Rik <rik5>
Group administrator
Thu 17 Nov 2016 02:40:29 AM UTC, comment #2: 

Tried Octave 4.2 for Windows 64bit and got the same result:

>> mkdir('c:/','test');
>> fid = fopen('c:/test/test[1].txt','w')

fid =  3

>> fputs(fid,"This is a test");
>> fclose(fid);
>> [status, msg, msgid] = copyfile('c:/test/test[1].txt','c:/test/test[2].txt');

error: copyfile: no files to move
error: called from
    copyfile at line 85 column 5

No Joy!

Richard Suchland <suchland>
Wed 16 Nov 2016 09:45:27 PM UTC, comment #1: 

If this is indeed related to bug #47950, then it should be fixed in Octave 4.2. Can you download and try it with 4.2? Or someone else with access to Windows confirm that 4.2 fixes this example?

Mike Miller <mtmiller>
Group Member
Wed 16 Nov 2016 09:42:10 PM UTC, original submission:  

Tried to copy a file with [ and ] characters in the filename and it failed.  I suspect this may be related to Octave bug ##47950.
Here is a sample:

mkdir('c:/','test');
fid = fopen('c:/test/test[1].txt','w')
fputs(fid,"This is a test");
fclose(fid);
[status, msg, msgid] = copyfile('c:/test/test[1].txt','c:/test/test[2].txt');
[status, msg, msgid] = copyfile('c:/test/test[[]1].txt','c:/test/test[3].txt'); # applying workaround proposed in bug #47950

Works with the proposed workaround for bug #47950 but not without

Richard Suchland <suchland>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by suchland (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-24 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-01-22 mmuetzel StatusConfirmed Ready For Test
        Release4.2.0 dev
    2016-11-17 rik5 Item GroupIncorrect Result Matlab Compatibility
        StatusNeed Info Confirmed
        Release4.0.0 4.2.0
    2016-11-16 mtmiller StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code