Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread Ruediger Pluem


bre...@apache.org wrote:
> Author: breser
> Date: Sat Oct 19 19:10:33 2013
> New Revision: 1533810
> 
> URL: http://svn.apache.org/r1533810
> Log:
> Add an option to autocreate directories to rotatelogs.
> 
> * support/rotatelogs.c
>   (rotate_config): Remove const from szLogRoot since we'll be passing it to
> apr_filepath_merge.  Add create_path member.
>   (usage, dumpConfig): Update to reflect new -d option.
>   (doRotate): Add code that knows how to create the directories a log file
> is going to go into.
>   (main): Add the -d option and canonicalize the incoming path with
> apr_filepath_merge() so that the code in doRotate can work properly.
> 
> * docs/man/rotatelogs.8,
>   docs/manual/programs/rotatelogs.html.en: Update for -d option.
> 
> PR: 46669
> Submitted by: Philippe Lantin 
>   (which was actually a patch written by myself when I worked 
> there)
> Tweaked by: breser (ported to trunk and changed option from -p to -d)
> 
> 
> Modified:
> httpd/httpd/trunk/docs/man/rotatelogs.8
> httpd/httpd/trunk/docs/manual/programs/rotatelogs.html.en
> httpd/httpd/trunk/support/rotatelogs.c
> 

> Modified: httpd/httpd/trunk/support/rotatelogs.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/support/rotatelogs.c?rev=1533810&r1=1533809&r2=1533810&view=diff
> ==
> --- httpd/httpd/trunk/support/rotatelogs.c (original)
> +++ httpd/httpd/trunk/support/rotatelogs.c Sat Oct 19 19:10:33 2013

> @@ -430,6 +433,23 @@ static void doRotate(rotate_config_t *co
>  }
>  }
>  apr_pool_create(&newlog.pool, status->pool);
> +if (config->create_path) {
> +char *ptr = strrchr(newlog.name, '/');
> +if (ptr && ptr > newlog.name) {
> +char *path = apr_pstrmemdup(newlog.pool, newlog.name, ptr - 
> newlog.name);
> +if (config->verbose) {
> +fprintf(stderr, "Creating directory tree %s\n", path);
> +}
> +rv = apr_dir_make_recursive(path, APR_FPROT_OS_DEFAULT, 
> newlog.pool);
> +if (rv != APR_SUCCESS) {
> +char error[120];
> +
> +apr_strerror(rv, error, sizeof error);
> +fprintf(stderr, "Could not create directory '%s' (%s)\n", 
> path, error);

Can't we use apr_psprintf  with %pm instead of the constant length buffer char 
[120]?

> +exit(2);
> +}
> +}
> +}
>  if (config->verbose) {
>  fprintf(stderr, "Opening file %s\n", newlog.name);
>  }


Regards

Rüdiger


Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread André Malo
* bre...@apache.org wrote:

> Author: breser
> Date: Sat Oct 19 19:10:33 2013
> New Revision: 1533810

> * docs/man/rotatelogs.8,
>   docs/manual/programs/rotatelogs.html.en: Update for -d option.

Huh. These files are both generated (or should be). Please update 
rotatelogs.xml instead.

nd
-- 
"Die Untergeschosse der Sempergalerie bleiben währenddessen aus
 statistischen Gründen geflutet." -- Spiegel Online


Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread Ben Reser
On 10/20/13 5:31 AM, Ruediger Pluem wrote:
>>  apr_pool_create(&newlog.pool, status->pool);
>> +if (config->create_path) {
>> +char *ptr = strrchr(newlog.name, '/');
>> +if (ptr && ptr > newlog.name) {
>> +char *path = apr_pstrmemdup(newlog.pool, newlog.name, ptr - 
>> newlog.name);
>> +if (config->verbose) {
>> +fprintf(stderr, "Creating directory tree %s\n", path);
>> +}
>> +rv = apr_dir_make_recursive(path, APR_FPROT_OS_DEFAULT, 
>> newlog.pool);
>> +if (rv != APR_SUCCESS) {
>> +char error[120];
>> +
>> +apr_strerror(rv, error, sizeof error);
>> +fprintf(stderr, "Could not create directory '%s' (%s)\n", 
>> path, error);
> 
> Can't we use apr_psprintf  with %pm instead of the constant length buffer 
> char [120]?

Only if we require APR 1.3.x or newer since %pm wasn't added till 1.3.0:
https://apr.apache.org/docs/apr/1.4/group__apr__lib.html#gad2cd3594aeaafd45931d1034965f48c1

The implementation I used here is similar to out error handling already in the
file.


Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread Ben Reser
On 10/20/13 5:37 AM, André Malo wrote:
> * bre...@apache.org wrote:
> 
>> Author: breser
>> Date: Sat Oct 19 19:10:33 2013
>> New Revision: 1533810
> 
>> * docs/man/rotatelogs.8,
>>   docs/manual/programs/rotatelogs.html.en: Update for -d option.
> 
> Huh. These files are both generated (or should be). Please update 
> rotatelogs.xml instead.

Oops thanks fixed in r1533935.

Why are the generated files committed though?



Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread Jeff Trawick
On Sun, Oct 20, 2013 at 1:54 PM, Ben Reser  wrote:

> On 10/20/13 5:31 AM, Ruediger Pluem wrote:
> >>  apr_pool_create(&newlog.pool, status->pool);
> >> +if (config->create_path) {
> >> +char *ptr = strrchr(newlog.name, '/');
> >> +if (ptr && ptr > newlog.name) {
> >> +char *path = apr_pstrmemdup(newlog.pool, newlog.name, ptr
> - newlog.name);
> >> +if (config->verbose) {
> >> +fprintf(stderr, "Creating directory tree %s\n", path);
> >> +}
> >> +rv = apr_dir_make_recursive(path, APR_FPROT_OS_DEFAULT,
> newlog.pool);
> >> +if (rv != APR_SUCCESS) {
> >> +char error[120];
> >> +
> >> +apr_strerror(rv, error, sizeof error);
> >> +fprintf(stderr, "Could not create directory '%s'
> (%s)\n", path, error);
> >
> > Can't we use apr_psprintf  with %pm instead of the constant length
> buffer char [120]?
>
> Only if we require APR 1.3.x or newer since %pm wasn't added till 1.3.0:
>
> https://apr.apache.org/docs/apr/1.4/group__apr__lib.html#gad2cd3594aeaafd45931d1034965f48c1
>
> The implementation I used here is similar to out error handling already in
> the
> file.
>

trunk and 2.4.x branch:

checking for APR... configure: WARNING: APR version 1.4.0 or later is
required, found 1.3.13
configure: WARNING: Found APR in
/home/trawick/inst/apr13-64/bin/apr-1-config, but we think it is considered
unacceptable
configure: error: the --with-apr parameter is incorrect. It must specify an
install prefix, a build directory, or an apr-config file.
configure failed

(I always forget about %pm :( )

-- 
Born in Roswell... married an alien...
http://emptyhammock.com/


Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread André Malo
* Ben Reser wrote:

> On 10/20/13 5:37 AM, André Malo wrote:
> > * bre...@apache.org wrote:
> >> Author: breser
> >> Date: Sat Oct 19 19:10:33 2013
> >> New Revision: 1533810
> >>
> >> * docs/man/rotatelogs.8,
> >>   docs/manual/programs/rotatelogs.html.en: Update for -d option.
> >
> > Huh. These files are both generated (or should be). Please update
> > rotatelogs.xml instead.
>
> Oops thanks fixed in r1533935.
>
> Why are the generated files committed though?

For one thing, oversight. The docs are shipped in generated form, and 
failures can be seen early (the docs build process happens to fail from 
time to time, because of weird java reasons (typically stack sizes and 
character encodings - depending on OS and java installation)).

The other thing is, that the docs are simply checked out for the online 
manual.

nd
-- 
"Das Verhalten von Gates hatte mir bewiesen, dass ich auf ihn und seine
beiden Gefährten nicht zu zählen brauchte" -- Karl May, "Winnetou III"

Im Westen was neues: 


Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-20 Thread Ben Reser
On 10/20/13 11:23 AM, Jeff Trawick wrote:
> trunk and 2.4.x branch:
> 
> checking for APR... configure: WARNING: APR version 1.4.0 or later is 
> required,
> found 1.3.13
> configure: WARNING: Found APR in /home/trawick/inst/apr13-64/bin/apr-1-config,
> but we think it is considered unacceptable
> configure: error: the --with-apr parameter is incorrect. It must specify an
> install prefix, a build directory, or an apr-config file.
> configure failed
> 
> (I always forget about %pm :( )

Thanks I went look for that a bit and didn't find it.  So yes I guess we could
switch to %pm.





Re: svn commit: r1533810 - in /httpd/httpd/trunk: docs/man/rotatelogs.8 docs/manual/programs/rotatelogs.html.en support/rotatelogs.c

2013-10-22 Thread Ben Reser
On 10/20/13 5:31 AM, Ruediger Pluem wrote:
> Can't we use apr_psprintf  with %pm instead of the constant length buffer 
> char [120]?

Done in r1534895, r1534896 and r1534914.