Skip to content

Allow to pass a home-relative path to include#326

Closed
cgzones wants to merge 1 commit intologrotate:masterfrom
cgzones:tilde
Closed

Allow to pass a home-relative path to include#326
cgzones wants to merge 1 commit intologrotate:masterfrom
cgzones:tilde

Conversation

@cgzones
Copy link
Member

@cgzones cgzones commented May 15, 2020

Accept a path with leading "~/" in include directives and replace with the environment variable ${HOME} (if existent).

@kdudka
Copy link
Member

kdudka commented May 15, 2020

This definitely needs to be documented. Should we take the value from getpwuid(getuid())->pw_dir in case $HOME is unset to better emulate the tilde expansion in shell?

@dvzrv
Copy link

dvzrv commented May 28, 2020

@cgzones thanks for looking into this and following up on #322.

I'm not familiar with the code base, but this looks like it will do what I envisioned in the issue.

@cgzones cgzones marked this pull request as ready for review May 28, 2020 13:13
Copy link
Member

@kdudka kdudka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! Please keep the code ISO C90 compliant:

config.c: In function ‘readConfigFile’:
config.c:1495:33: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
 1495 |                                 const struct passwd *pwd = getpwuid(getuid());
      |                                 ^~~~~
config.c:1504:29: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
 1504 |                             char *new_key = NULL;
      |                             ^~~~

Please remove the dead dead assignment new_key = NULL; at end of the scope of new_key.

Accept a path with leading "~/" in include directives and replace with
either the environment variable ${HOME} (if existent) or the initial
working directory of the user.
@cgzones
Copy link
Member Author

cgzones commented May 30, 2020

Updated.

Can you please either mention to keep the code ISO C90 compliant, e.g. in CONTRIBUTING.md, or add the warning -Wdeclaration-after-statement?

@kdudka
Copy link
Member

kdudka commented Jun 1, 2020

@cgzones Pull request #328 enables the warning.

@kdudka kdudka closed this in 85d0c90 Jun 1, 2020
@cgzones cgzones deleted the tilde branch June 2, 2020 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants