gnc-backend-file.c: ERR_BACKEND_PERM too unspecific

Derek Atkins warlord at MIT.EDU
Mon Dec 5 17:11:42 EST 2005


Quoting Tim Wunder <tim at thewunders.org>:

> OK, I know I'm not qualified to have a legitimate opinion on this, 
> but can you
> answer a stupid question for me?
> As I understand the process, gnucash renames the existing file, then 
> creates a
> new file of the same name, then chowns it to whatever the permissions of the
> original file was. This seems really odd to me.

It's not odd at all.  LOTS of programs do this.  emacs does this,
for example.  It will rename() the old file to the tilde-file,
and then create the new file and write your new data to it.  Then
it reverts the file permissions to the original version.

> Why is a new data file created at all? Why isn't the original data 
> file simply
> copied (like a cp -a) to the backup file.

"cp" is a command-line utility.  There is no "cp" API function.

>    Let the O/S deal with permissions.
> Derek's suggestion to not chown at all and "forego the group setting
> completely and assume the user has a proper setgid setting on the directory"
> seems reasonable to me.

You're confusing chown() and chmod().
chown() changes ownership.  chmod changes the mode permissions.

> Regards,
> Tim

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list