Can someone please confirm that the following behaviour is not intended, and is in fact a bug in AmigaOS4.1:
If I perform CurrentDir(lock) using a lock on 'Volume:Folder', then GetCurrentDirName() unexpectedly still shows the old (unchanged) current directory. This looks like a bug to me.
But if I perform SetCurrentDirName('Volume:Folder'), and it returns success, then as expected GetCurrentDirName() shows 'Volume:Folder' as the current directory.
Bug in CurrentDir() or possibly GetCurrentDirName() ?
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
When using CurrentDir(), I can find out the correct current directory by giving myProcess.pr_CurrentDir to NameFromLock(). So I am inclined to say that GetCurrentDirName() is somehow buggy.
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
@ChrisH
I threw together a quick shell program to test GetCurrentDirName() and it does appear to get the wrong name.
NameFromLock confirms that problem is not CurrentDir(). The dos AutoDocs proclaim GetCurrentDirName() as having bugs but doesn't mention the bug you have found. This is bad news for programs that aren't expecting this bug and it would be advisable to use the alternative function call suggested in the dos AutoDocs; even though it would be for reasons other than the ones stated in the AutoDocs. This might explain why some programs don't find the files they are looking for unless the files are in the current directory.
I threw together a quick shell program to test GetCurrentDirName() and it does appear to get the wrong name.
NameFromLock confirms that problem is not CurrentDir(). The dos AutoDocs proclaim GetCurrentDirName() as having bugs but doesn't mention the bug you have found. This is bad news for programs that aren't expecting this bug and it would be advisable to use the alternative function call suggested in the dos AutoDocs; even though it would be for reasons other than the ones stated in the AutoDocs. This might explain why some programs don't find the files they are looking for unless the files are in the current directory.
Last edited by xenic on Sat Sep 24, 2011 3:35 am, edited 1 time in total.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
@xenic
Thanks for confirming this is the wrong behaviour, and for duplicating it. I will create a bug report for it (as none seems to exist).
Thanks for confirming this is the wrong behaviour, and for duplicating it. I will create a bug report for it (as none seems to exist).
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
@xenic
At appears that the behaviour I saw is NOT a bug, rather due to my not understanding a quirk on AmigaDOS's design. However, I am still not entirely sure I understand why (I think there are two different "Current Directories"!) so I won't post more until I understand for sure.
At appears that the behaviour I saw is NOT a bug, rather due to my not understanding a quirk on AmigaDOS's design. However, I am still not entirely sure I understand why (I think there are two different "Current Directories"!) so I won't post more until I understand for sure.
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
I think somebody is blowing hot air up your sleeve because by definition there can only be one "current" directory. Current means the present moment and directory is singular not plural (directories). Maybe in a parallel universe your Amiga has another current directory but not in this oneChrisH wrote:At appears that the behaviour I saw is NOT a bug, rather due to my not understanding a quirk on AmigaDOS's design. However, I am still not entirely sure I understand why (I think there are two different "Current Directories"!) so I won't post more until I understand for sure.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
I think the guy who rewrote most of dos.library knows a tad more than you do...xenic wrote:I think somebody is blowing hot air up your sleeve because by definition there can only be one "current" directory.
ExecSG Team Lead
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
Reading the Autodoc, I would avoid GetCurrentDirName(). It appears to only exist for legacy reasons - it even says that it is better to use GetCurrentDir/NameFromLock! It ought to be marked as DEPRECATED.ChrisH wrote:Can someone please confirm that the following behaviour is not intended, and is in fact a bug in AmigaOS4.1:
If I perform CurrentDir(lock) using a lock on 'Volume:Folder', then GetCurrentDirName() unexpectedly still shows the old (unchanged) current directory. This looks like a bug to me.
But if I perform SetCurrentDirName('Volume:Folder'), and it returns success, then as expected GetCurrentDirName() shows 'Volume:Folder' as the current directory.
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
A lot of people know more than I do The GetCurrentDirName() autodoc states that it gets the CLI's current directory (cli.cli_CurrentDirName) which ChrisH and I have apparently misinterpreted to mean the program's (process) current directory. Maybe an additional statement in the autodoc like "The CLI current directory can be different than a process's current directory" would help. It too late to change function names but this function should really have been named GetCliCurrentDirName(). I guess I was the one blowing smokessolie wrote:I think the guy who rewrote most of dos.library knows a tad more than you do...xenic wrote:I think somebody is blowing hot air up your sleeve because by definition there can only be one "current" directory.
AmigaOne X1000 with 2GB memory - OS4.1 FE
- thomasrapp
- Posts: 310
- Joined: Sat Jun 18, 2011 11:22 pm
Re: Bug in CurrentDir() or possibly GetCurrentDirName() ?
You still didn't understand it right. There is no CLI current dir and process current dir. There can be only one current dir. But we are not talking about the current dir but about the current dir name. The CurrentDirName is a variable in the CLI structure which can be set by SetCurrentDirName and read by GetCurrentDirName. Nothing more. It is completely unrelated to the real current dir. The CD command sets it and the prompt %s placeholder reads it. It's not used anywhere else. It is not set automatically. And of course you are right, from a non-system programmer's point of view it is misleading and almost useless. The real current dir is a lock, not a string.