Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
87 user(s) are online (77 user(s) are browsing Forums)

Members: 2
Guests: 85

emeck, rjd324, more...

Support us!

Headlines

 
  Register To Post  

Is this a bug? FOpen()
Supreme Council
Supreme Council


See User information
If you use FOpen(MODE_NEWFILE) on an existing file that is write protected (EXDF_WRITE) then the comment of the file is cleared.

The content, modified date and protection flags stay the same but the comment is cleared for some reason.

Is this a bug or just yet another "feature" of OS4.x?

(For the wise guys: yes I know I can check the file if it's write protected before using fopen(). This is not about asking for a workaround/solution)

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Is this a bug? FOpen()
Just can't stay away
Just can't stay away


See User information
@orgin

Have you tried with a different filesystem?

Sounds like the filesystem code is clearing the comment before checking the write flag. Definitely a bug IMO.

Go to top
Re: Is this a bug? FOpen()
Supreme Council
Supreme Council


See User information
@salass00

Hmm, yeah it was tested on the ram disk.

I just tried on a hard drive partition with SFS and it didn't respect the write flag at all (SFS). The file was overwritten without any error (including comment, date and protect flags)

Just noticed another error, when opening a file in notepad, editing it and then saving it also deletes the comment (SFS). This does not happen in ram: however.

Ohh well, seems file handling is quite a bit inconsistent ....


Anyone with FFS2 or JXFS that can test these behaviors on those file systems?

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Is this a bug? FOpen()
Amigans Defender
Amigans Defender


See User information
@orgin

i'm sure that happens also on FFS since with ATC when i transfer files from Mac->A1 and the file system clear also the executable bit for example

Go to top
Re: Is this a bug? FOpen()
Not too shy to talk
Not too shy to talk


See User information
@afxgroup

FFS does not clear the E bit.

If you Open() a file with MODE_NEWFILE, FFS will set RWED and clear the file note. If something else is desired, this has to be done by the application. For example if EditPad should preserve the file note, it has to do so, not the file system.

Bye,
Thomas

Go to top
Re: Is this a bug? FOpen()
Just can't stay away
Just can't stay away


See User information
@orgin

Quote:
I just tried on a hard drive partition with SFS and it didn't respect the write flag at all (SFS).
Of course not. Unlike for example Unix AmigaOS has separate write and delete permissions. [F]Open("ExistingFile", MODE_NEWFILE) is a delete (+ create new file) operation, not a write (something to an existing file).

Quote:
The file was overwritten without any error (including comment, date and protect flags)
Unless you copy them from the old file the new file has the default protection bits (for example ---- ---- ----rw-d), comment (none), date/time (current time), etc.

To get what you expect, modifying an existing file instead of replacing it with a new one, you have to use something like
file = IDOS->FOpen("foobar", MODE_READWRITE, buffersize);
IDOS->ChangeMode(file, CHANGE_FH, EXCLUSIVE_LOCK);
IDOS->ChangeFileSize(file, 0, OFFSET_BEGINNING);
instead, which works on delete protected but not on write protected files and keeps the protection bits, comments, user/group, etc., instead of using file = IDOS->FOpen("foobar", MODE_NEWFILE, buffersize) which replaces the file with a completely new one (unless the old one was delete protected).


Edited by joerg on 2009/3/19 17:45:01
Edited by joerg on 2009/3/19 17:45:57
Go to top
Re: Is this a bug? FOpen()
Supreme Council
Supreme Council


See User information
@joerg

Quote:
Of course not. Unlike for example Unix AmigaOS has separate write and delete permissions. [F]Open("ExistingFile", MODE_NEWFILE) is a delete (+ create new file) operation, not a write (something to an existing file).


Translation of the above text: "in my opinion the ram disk file system has a bug"




To repeat in simple terms:

I have a file in ram: that is write protected.

Using FOpen(..MODE_NEWFILE..) on it clears the comment field

The contents of the file does not change

Writing data to the file is not possible, gives you write error

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project