Here is the patch, for "mkdir 777" In Redhat "/etc/init.d/functions" contains a "umask 0022" and the init script of collectd source it. I don't know if it's the same for other releases, but, perhaps it'll be a good idea to create a "/etc/default/$prog" which contain an umask 0022. $prog have not the same value for redhat (collectdmon), sles10/fedora (collectd) For AIX init script already have a umask 022
Best regards ----- Message d'origine ----- De: Bruno Prémont <[email protected]> Date: Thu, 29 Mar 2012 13:35:39 +0200 Sujet: Re: [collectd] rrdc_update failed with status -1 À: Benjamin DUPUIS <[email protected]> Cc: [email protected] >On Thu, 29 Mar 2012 13:25:30 Benjamin DUPUIS wrote: >> umask in init script doesn't work for me (RHEL5). > >As documented in mkdir()'s manpage, the mask specified has umask >applied on it. If the specified mode is more restrictive than umask it >will win, thus mode should first be set to permissive, e.g. 0777, and >then umask will work. > >> I never coded in C, only C++ for more than 10 years ago :) > >Adding umask as configuration option is slightly harder but should be >easy looking at how other global options are defined. > >The change you listed as one-liner looks good to me, just check the >rest of collectd code for more mkdir() invocations and send the patch >(which you can obtain it with `git patch --path-with-stat` if you >previously cloned git repo) > >Best regards, >Bruno > >> ----- Message d'origine ----- >> De: Bruno Prémont <[email protected]> >> Date: Thu, 29 Mar 2012 12:00:12 +0200 >> Sujet: Re: [collectd] rrdc_update failed with status -1 >> À: Benjamin DUPUIS <[email protected]> >> Cc: [email protected] >> >> >On Thu, 29 Mar 2012 11:46:16 Benjamin DUPUIS wrote: >> >> I've modified >> >> * src/collectd.c Line 211 : if (mkdir (orig_dir, 0775) == -1) >> >> * src/common.c Line 551 : if (mkdir (dir, 0775) == 0) >> >> >> >> It's now working. >> >> I don't know if it's a good solution perhaps it'll be a good idea to >> >> have a configuration entry in the configuration of rrdcached / >> >> rrdtools ? >> > >> >I think it would even be better to change mode to 0777 and let umask do >> >the whole work, eventually having global umask configuration option in >> >collectd config file so umask setting does not have to be delegated to >> >init script (where it is not set and thus depends on umask of init or >> >the shell [re]starting the daemon). >> > >> >The same has to apply for csv and the other write plugins that may >> >create new files. >> > >> >Having configurable mode gets hard, especially as then on might also >> >want to control owner/group and possibly ACLs or more! >> > >> >Would you mind creating a patch for it? > >_______________________________________________ >collectd mailing list >[email protected] >http://mailman.verplant.org/listinfo/collectd > >
mkdir_perms.patch
Description: Binary data
_______________________________________________ collectd mailing list [email protected] http://mailman.verplant.org/listinfo/collectd
