Page 1 of 1

Join reverse-concatenates files

Posted: Sat Apr 27, 2013 7:40 am
by saimo
Hello,

when the input files are specified to Join with wildcards, Join first sorts the files and then concatenates them. I have just noticed, though, that now the concatenation is performed in reverse (before, I'm pretty sure that the sort order was increasing).
Here's a simple script for a quick test.

Code: Select all

Set i 0
Lab loop
Echo "$i " NOLINE >RAM:test$i
Set i `Eval $i + 1`
If NOT $I EQ 10
	Skip BACK loop
EndIf

Join RAM:test? TO RAM:test
Type RAM:test

Re: Join reverse-concatenates files

Posted: Sat Apr 27, 2013 8:14 am
by LyleHaze
My old AmigaDos manual says they are joined in the order given, no mention is made of wildcard support or sorting.
The description given in sys:documentation/c/join.doc matches the book, and no mention of wildcards or sorting is offered.
I checked the AmigaOS documentation WIKI at http://wiki.amigaos.net/index.php/Main_Page, did a search of "join",
and while I found a few examples, again, no mention of wildcards or sorting.

I'm NOT calling you wrong, I'm just asking where the behavior you are seeking is documented?

Thanks,
Lyle

Re: Join reverse-concatenates files

Posted: Sat Apr 27, 2013 9:41 am
by thomasrapp
@saimo

From what you describe I would not expect Join to sort files at all. It just joins them in the order they appear in the directory list. The order of files in the directory list is dependent of the file system used and can change when you add new files. IIRC the ram disk shows newest file first.

Put a

Code: Select all

list ram:test?
before the join. And make ram: a variable so that you can test different drives with different file systems.

I agree that this is rather useless. That's probably the reason why it's not documented yet. Some options should be added which allow to control the sort order.

Re: Join reverse-concatenates files

Posted: Sat Apr 27, 2013 4:51 pm
by saimo
Guys,

it occurred to me that maybe the sorting was a 3.5/9 feature, but the manual indicates nothing, just like you said.

Yesterday I executed a Join and I didn't get the result I naturally expected, so, not having the latest documentation at reach, I made a quick search on the net and the first useful result I found (the second if you Google for "amigados join" at the moment) was this, which confirmed what I expected. Now I notice that that's not the official documentation, though.
Now I made another test and, indeed, Join performs no sorting.

It's strange, I really feel like something I was used to has suddenly changed (on 3.x I used a replacement command that did perform sorting, but I haven't been using 3.x for ages, whereas my feeling is fresh).
Anyway, yes, a sorting option would be most welcome :)

Re: Join reverse-concatenates files

Posted: Sat Apr 27, 2013 10:23 pm
by nbache
I'd even say it ought to sort by default, or maybe even always instead of optionally.

Whoever, back in 2.x, thought about adding the ability to use a pattern instead of a list of files, should have figured out that joining files in a non-deterministic sequence is rarely, if ever, useful.

Best regards,

Niels

Re: Join reverse-concatenates files

Posted: Sun Apr 28, 2013 10:16 am
by saimo
nbache wrote:I'd even say it ought to sort by default, or maybe even always instead of optionally.
Yes. For completeness, maybe there could be the flags ASFOUND/S (i.e. as fed by the filesystem) and RANDOM/S (intentionally randomized).
Whoever, back in 2.x, thought about adding the ability to use a pattern instead of a list of files, should have figured out that joining files in a non-deterministic sequence is rarely, if ever, useful.
Indeed.

Re: Join reverse-concatenates files

Posted: Sun Apr 28, 2013 5:05 pm
by nbache
This turns out to be on Bugzilla already since 2010, BZ 6372. I have added a reference to this thread and quoted the above suggestion.

Best regards,

Niels

Re: Join reverse-concatenates files

Posted: Sun Apr 28, 2013 5:24 pm
by saimo
Many thanks :)

Re: Join reverse-concatenates files

Posted: Thu May 02, 2013 1:12 pm
by salass00
This issue should be fixed in Join 53.2 (it sorts the matched filenames alphabetically using IUtility->Stricmp() as comparison function).

Re: Join reverse-concatenates files

Posted: Thu May 02, 2013 1:59 pm
by saimo
salass00 wrote:This issue should be fixed in Join 53.2 (it sorts the matched filenames alphabetically using IUtility->Stricmp() as comparison function).
Nice news :)
Kiitos!