Join reverse-concatenates files

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
User avatar
saimo
Posts: 94
Joined: Sat Oct 29, 2011 11:37 pm
Contact:

Join reverse-concatenates files

Post 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
User avatar
LyleHaze
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 525
Joined: Sat Jun 18, 2011 5:06 pm
Location: North Florida, near the Big Bend

Re: Join reverse-concatenates files

Post 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
User avatar
thomasrapp
Posts: 318
Joined: Sun Jun 19, 2011 12:22 am

Re: Join reverse-concatenates files

Post 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.
User avatar
saimo
Posts: 94
Joined: Sat Oct 29, 2011 11:37 pm
Contact:

Re: Join reverse-concatenates files

Post 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 :)
User avatar
nbache
Beta Tester
Beta Tester
Posts: 1744
Joined: Mon Dec 20, 2010 7:25 pm
Location: Copenhagen, Denmark
Contact:

Re: Join reverse-concatenates files

Post 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
User avatar
saimo
Posts: 94
Joined: Sat Oct 29, 2011 11:37 pm
Contact:

Re: Join reverse-concatenates files

Post 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.
User avatar
nbache
Beta Tester
Beta Tester
Posts: 1744
Joined: Mon Dec 20, 2010 7:25 pm
Location: Copenhagen, Denmark
Contact:

Re: Join reverse-concatenates files

Post 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
User avatar
saimo
Posts: 94
Joined: Sat Oct 29, 2011 11:37 pm
Contact:

Re: Join reverse-concatenates files

Post by saimo »

Many thanks :)
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Join reverse-concatenates files

Post by salass00 »

This issue should be fixed in Join 53.2 (it sorts the matched filenames alphabetically using IUtility->Stricmp() as comparison function).
User avatar
saimo
Posts: 94
Joined: Sat Oct 29, 2011 11:37 pm
Contact:

Re: Join reverse-concatenates files

Post 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!
Post Reply