bugGNU Octave - Bugs: bug #57774, fullfile error with cell array...


bug #57774: fullfile error with cell array input other than last

Submitted by:  Paul Netsaver <netsaver>
Submitted on:  Sat 08 Feb 2020 10:26:17 PM UTC  
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Netsaver Paul Open/Closed:  Closed
Release:  dev Operating System:  Any

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)

Sat 30 May 2020 02:36:13 PM UTC, comment #11: 

No complaints so far and the BISTs pass.
Closing as fixed.

Markus Mützel <mmuetzel>
Project Member
Sun 03 May 2020 02:27:19 PM UTC, comment #10: 

It looks like Vishnu might have abandonded that change. Maybe because GSOC application is over now?
I hope he doesn't mind that I went ahead and made the necessary changes here:

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
Sun 12 Apr 2020 05:48:45 PM UTC, comment #9: 

Maybe I should specify what I meant. Consider this example that adds a "1" in between each initial matrix element:

>> a=11:14
a =

   11   12   13   14

>> a(2,:) = 1;
>> a(:).'
ans =

   11    1   12    1   13    1   14    1

I'm sure it is also possible to add a file separator in between of each element of the input cell array varargin. The remainder should be trivial given the behavior of "strcat".
Logic that removes multiple subsequent file separators is already there.

Regarding assigning the bug: Savannah is configured such that bugs can be assigned only to maintainers. If you want to work on this bug, you can always do that.
To avoid duplicate work, I guess people are very unlikely to pick a bug that has recent activity by someone else.

Markus Mützel <mmuetzel>
Project Member
Sun 29 Mar 2020 06:41:23 PM UTC, comment #8: 

Ok. I will modify the code using similar implementation. Meanwhile, can this bug be assigned to me?

vishnu parammal <vishnuparammal>
Sun 29 Mar 2020 11:18:06 AM UTC, comment #7: 

I like the fact that you added some input validation.
However, your implementation doesn't look very efficient. Loops (especially nested loops) should be avoided if possible because they tend to be slow in .m files.
I haven't thought it through completely yet. But shouldn't it be possible to do what you want by some clever use of "strcat"?
Take e.g. this:

> strcat({'a', 'b'}, 'c', {'d', 'e'})
ans =
  [1,1] = acd
  [1,2] = bce

It looks like it does already most of what is needed here.

Markus Mützel <mmuetzel>
Project Member
Sat 28 Mar 2020 09:58:31 PM UTC, comment #6: 

I have modified the code and ran the test successfully on my Ubuntu 16.04 machine. It seems to be good now. I am attaching the diff file.

(file #48696)

vishnu parammal <vishnuparammal>
Sat 28 Mar 2020 02:58:00 PM UTC, comment #5: 

Your modification breaks the BISTs for "fullfile" for me.
In particular, fullfile("") should return a 0x0 empty string. But it returns a 1x0 empty string with your modification.

You can check the BISTs in .m files by executing "test FILE" in Octave.
So in this case:

test fullfile

Markus Mützel <mmuetzel>
Project Member
Thu 19 Mar 2020 02:20:23 PM UTC, comment #4: 

I am attaching the diff file for review

(file #48626)

vishnu parammal <vishnuparammal>
Wed 18 Mar 2020 10:48:15 PM UTC, comment #3: 

If you are set up to do so I would recommend you create a changeset and post the diff patch here.

Nicholas Jankowski <nrjank>
Wed 18 Mar 2020 09:55:50 PM UTC, comment #2: 

I have a solution. The results are matching as expected in the comment #1. I have verified it with the results from Matlab. I have also written a test case at the end for this bug. The solution is working on my Ubuntu 16.04. I have attached the file. Please verify.

(file #48624)

vishnu parammal <vishnuparammal>
Sat 08 Feb 2020 11:48:03 PM UTC, comment #1: 

Thank you for finding and describing this missing feature. Confirmed with Octave's development branch, and verified on Matlab's web site. Can you help improve fullfile to make this feature work in Octave?

Mike Miller <mtmiller>
Project Administrator
Sat 08 Feb 2020 10:26:17 PM UTC, original submission:  

It seems to be a difference with Matlab about function fullfile:

output = fullfile({'folder1','folder2'},'sub',{'f1.m','f2.m'})

it should accept inputs: folders={'folder1','folder2'} and files={'f1.m','f2.m'} as they have the same length.

In general it should accept cell-array-of-strings inputs whose length is 1 or N, producing in output a cell array of size 1xN:

output = {
[1,1] = folder1/sub/f1.m
[1,2] = folder2/sub/f2.m

Paul Netsaver <netsaver>


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

Attach Files:

Attached Files
file #48696:  fullfile.diff added by vishnuparammal (3KiB - application/octet-stream)
file #48626:  fullfile.diff added by vishnuparammal (2KiB - application/octet-stream)
file #48624:  fullfile1.m added by vishnuparammal (5KiB - application/octet-stream - fullfile)


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 nrjank (Posted a comment)
  • -email is unavailable- added by vishnuparammal (Updated the item)
  • -email is unavailable- added by netsaver (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-30 mmuetzel StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2020-05-03 mmuetzel StatusConfirmed => Ready For Test
    2020-03-28 vishnuparammal Attached File- => Added fullfile.diff, #48696
    2020-03-19 vishnuparammal Attached File- => Added fullfile.diff, #48626
    2020-03-18 vishnuparammal Attached File- => Added fullfile1.m, #48624
    2020-02-08 mtmiller Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        StatusNone => Confirmed
        Release5.2.0 => dev
        Operating SystemMicrosoft Windows => Any

    Back to the top

    Powered by Savane 3.5