Copy Command
Steve Pampling (1551) 8172 posts |
See PRM. Newer is supposed to do that (if newer) and when we go back a few days Stuart said:
Is it? Isn’t it? |
Alan Adams (2486) 1149 posts |
So maybe use this as a start – if I can get textile to accept it without mangling the layout. It will only look right in a mono-spaced font, but I don’t think I can add a CSV file here, which would be the ideal way.
|
Alan Adams (2486) 1149 posts |
Just tested this. *copy with ~C won’t overwrite – Newer is not involved. So the copy command doesn’t overwrite ANYTHING unless Force is set. Filer_Action always overwrites if C is unset, unless the destination is locked. In both cases, if Newer is set, an overwrite attempt is only considered if the source is newer than the destination. |
Rick Murray (539) 13850 posts |
What Steve said… and me… and others. Newer should overwrite if newer, as the description implies. It’s worth noting, also, that the current (botched, IMHO) implementation does not allow for copying newer files but leaving locked ones alone. The need to Force with Newer just to get it to work is therefore ridiculous. FilerAction’s way of doing it is much more logical. |
Alan Adams (2486) 1149 posts |
More intuitive certainly. The main weakness with *copy’s operation is that you can’t update a folder while protecting locked files. You either don’t update, or you also change the locked files. I wonder how much would break if *copy were to be changed to match Filer_Action? !Sysmerge? The other significant difference is that Filer_Action always recurses into directories. *copy by default only changes the directory specified, and without R it errors if it tries to copy a directory that didn’t already exist. |
John WILLIAMS (8368) 495 posts |
I sense we’re no nearer “a generally agreed document somewhere which will (tautology warning) definitively define the various behaviours!” I wait patiently! |
Steve Pampling (1551) 8172 posts |
I think there’s pretty much an agreement on what both the Copy command and FilerAction should do. Alan has been mapping out what the two actually do and then there’s the existing documentation… I have an idea: why not make them both behave the same, both do what they should do and just for a little extra spice that behaviour could go in the documentation. Yeah, silly boy. |
Steve Fryatt (216) 2105 posts |
Potentially quite a lot, which is why changing it after 30 years would be a bad idea. Not least because once changed, it would then be impossible for anyone to use *Copy in a distributed script which might need to run on other versions of the OS as well. Clearly documenting what it does would be the far better option, I suspect. |
Chris Hall (132) 3558 posts |
N should always allow the over writing of an unlocked file with a newer file. That is one possibility. It is not what happens nor what the documentation says. The N flag prevents the copying of older files, which is a very different thing but much easier to understand. What we need is a flag (for the command line copy) that allows copying over existing objects separately from the F options which allows copying over locked (and existing) objects. A sort of lower case ‘F’. The behaviour of the ‘N’ flag in desktop copy with respect to the datestamps of directories (rather than the objects within them) should also be explained. Are the contents of an older directory ignored for example when the ‘N’ flag is set? Some filing systems update the date of the directory when files are added. The FilerAction already copies recursively and over existing objects, so is fine, just very poorly described in PRM 3-236 as the flags are not described at all and are different from their use in the command line copy. |
David Pitt (3386) 1248 posts |
I have been slowly coming to that interpretation.
The F option perhaps should be explained the other way around, copy over existing (and locked) objects. N is a rider to F. Copying without F does show a file already exists warning and reports no file copied. |
Steve Pampling (1551) 8172 posts |
Which brings us back to the fact that N is broken, it doesn’t allow Newer files to overwrite unless you include the dangerous F option |
David J. Ruck (33) 1636 posts |
N should only look at the date stamps of files, and not directories. The behaviour of directory date stamps across different filing systems (including image filing systems) is very variable, and should not be relied upon. |
Alan Adams (2486) 1149 posts |
The underlying reason why this is confusing is that N is meaningless except when overwriting is contemplated. The fact that it still doesn’t overwrite unless F is specified is just plain wrong. The reason it happens like this is because copy doesn’t overwrite ANYTHING unless F is specified. N should change that, but doesn’t. The confusion arises because Filer_Action does the opposite, and those among us with less than 20 years of RISC OS experience will have used Filer_Action before using *copy. I still think *copy could be changed, because any script that specifies the options it needs will still work. Any that don’t specify the options can be edited. |
Stuart Swales (1481) 351 posts |
It is in fact nothing to do with locked state – F must stand for fuzzy memory. If a copy gets to the point of trying to copy a file, having passed tests for older/same datestamp rejection if N specified, not confirming etc. then it will attempt to ensure any target file is unlocked. Take a look at the actual OS_FSControl code, it seemed reasonably well commented as to its intent.
Indeed, and that’s what it does |
Alan Adams (2486) 1149 posts |
There are bits of Filer_Action that I haven’t seen documented. It doesn’t (seem) to make any use of Copy$Options. It’s settings are stored in a file within Boot and set with Configure. Are there any other options that can be put in there which Configure doesn’t make available? Copy uses A to copy the access settings of the destination from the source. What does Filer_action do? *copy has P to copy with the case of copying from one floppy to another on a single floppy drive. Filer_Action cannot encounter this case, as source and destination both need to be on screen to start the copy. Does *copy also use this in the case of copying from, for example hard disc to floppy, when the floppy becomes full. Does it ask for a continuation disc? Option D changes copy to do a move. Filer_action does this if the drag is done with Shift held down. Copy has option L (look at). I don’t know what that does in copy, and I don’t know therefore whether the equivalent needs to be documented in Filer_Action. |
Stuart Swales (1481) 351 posts |
Both DO need to be on screen, but may not both be in the same drive at once.
Of course not – we don’t have files spanning multiple media, and any new disc would have a different label, so the target would no longer be valid.
It was intended to allow Copy to take a peek at the destination to see if it had access permission before starting to copy data from the source. Can help to do ~L if copying floppy to floppy using a single drive. Different times, eh? |
Stuart Swales (1481) 351 posts |
Anyhow, slightly rewording Steve F, does anyone think it a good idea to change a 34 year old API rather than writing a new one? If so, where do you stop? |
Stuart Swales (1481) 351 posts |
Oh look, it is documented in the PRM (OS_FSControl 26) “It is not possible to choose a combination of flags to perform the same operation as “no confirm” in the desktop, as the desktop will overwrite files without confirmation, but won’t force the overwriting of locked files, whereas this SWI will only overwrite files if it either has force set, or confirm set and gets positive confirmation.” |
Alan Adams (2486) 1149 posts |
I wonder how many new users will: A see or know about the PRM B know OS_FSControl 26 exists C know it’s relevant to either *Copy or Filer_Action What matters is what is in the Help, and in the User Guide. |
Stuart Swales (1481) 351 posts |
It might be helpful then to say in the User Guide that Force (and other flag combinations) don’t do what you might think coming from other OSes. The documentation for Copy was severely trimmed between the RO 2 and 3 UGs. Haven’t seen anything later. |
Steve Pampling (1551) 8172 posts |
Yup, agreed 100% |
Steve Pampling (1551) 8172 posts |
Is that a paraphrasing of “it’s broken”? Because that’s the only correct answer. |
Steve Fryatt (216) 2105 posts |
So, why not fix Help and the User Guide? Making an established CLI command behave differently on (some versions of) RO5 compared to the other versions of the OS that are out there seems like a really bad idea, given that it’s actually operating as designed. |
Rick Murray (539) 13850 posts |
I think the question is, if Newer was modified to allow overwriting of non-locked files, as the description suggests, would anybody actually suffer from this? Due to the brokenness, it is quite likely that people have written scripts that use FN (or haven’t realised that their copy failed). |
David Pitt (3386) 1248 posts |
It’s fine once the meaning of the F switch is understood. (F)orce overwrite forces the copy over the file exists warning. Obviously (N)ewer only has meaning if overwrite is enabled, with (F)orce. The Filer configuration tool has a different action associated with Force, which is only about Locked files. The most that is required might be a little tweak to the documentation or *help. |