Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: configure: add --with-runstatedir option #136

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

gao-yan
Copy link
Member

@gao-yan gao-yan commented Oct 13, 2021

... and use it where appropriate.

Similar to ClusterLabs/pacemaker@36445bcbf1

... and use it where appropriate.
Copy link

@petervarkoly petervarkoly left a comment

Choose a reason for hiding this comment

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

It is ok for me

fi
eval runstatedir="$(eval echo ${runstatedir})"
AC_SUBST(runstatedir)

Choose a reason for hiding this comment

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

Did you see the expand_path_option thing Ken has just done in pacemaker?
We should as well consider if we want it synced with .../tests/configure.ac - better of course pull straight so that the copy isn't needed - had some issue i don't recall in detail for which this was a quick hack that persisted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you see the expand_path_option thing Ken has just done in pacemaker?

Alright, noticed it. We can add the same as well.

We should as well consider if we want it synced with .../tests/configure.ac - better of course pull straight so that the copy isn't needed - had some issue i don't recall in detail for which this was a quick hack that persisted.

OK, will add commits to get this synced with that one when everything is fine.

Choose a reason for hiding this comment

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

yep - will look over it after this PR and try to remember ... in the worst case we can still simply sync ...

@@ -242,7 +242,7 @@ Defaults to I<enabled>.
This can be used to override the default watchdog device used and should not
usually be necessary.

=item B<-p> F</var/run/sbd.pid>
=item B<-p> F</run/sbd.pid>

Copy link

@wenningerk wenningerk Oct 13, 2021

Choose a reason for hiding this comment

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

If we put something hacky like

sbd.8.pod: sbd.8.pod.in sbd.sysconfig.pod
	sed -e "s,@runstatedir@,$(runstatedir)," $< |sed -e "s/@environment_section@//;t insert;p;d;:insert;rsbd.sysconfig.pod" > $@

in man/Makefile.am we could even make it dynamic ;-)

Choose a reason for hiding this comment

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

Atm I have at least no good idea how to use the autoconf-config-file capabilities here :-(
having environment_section=$(shell cat sbd.sysconfig.pod) probably won't work as we can't get that in as prerequisite.
But maybe with the sed-code that creates sbd.sysconfig.pod ... depends on when/if the vars are evaluated ...

Copy link
Member Author

@gao-yan gao-yan Oct 14, 2021

Choose a reason for hiding this comment

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

I haven't figured out a better idea either. It's kind of tricky how any recognized variables are expanded by automake here, but it at least seems to work this way:

       sed -e "s,\@runstatedir\@,$(runstatedir)," $< |sed -e "s/@environment_section@//;t insert;p;d;:insert;rsbd.sysconfig.pod" > $@

@wenningerk
Copy link

Yep probably we'll need this for now as #135 won't be there quickly enough - and might not replace the pid-file fully - even with systemd (compat with older pacemaker still going for pid-file instead of asking systemd).

gao-yan and others added 2 commits October 13, 2021 17:13
Previously we expanded path variables like:

        eval prefix="`eval echo ${prefix}`"

Now, define a helper function expand_path_option for this, to improve
readability and isolate the eval madness. The helper can also take the
option default to reduce code duplication.

Additionally, expand_path_option requires the expanded value to be a full
path (i.e. start with a /), to perform some validation on user-supplied values.
@gao-yan gao-yan force-pushed the configure-with-runstatedir branch from de0ce8e to 515bae0 Compare October 14, 2021 11:07
expand_path_option infodir
expand_path_option mandir

AS_IF([test x"${runstatedir}" = x""], [runstatedir="${sbd_runstatedir}"])

Choose a reason for hiding this comment

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

didn't think of this when reviewing the change in pacemaker but that could actually be further optimized
with expand_path_option having a longer list of parameters at the end where it takes the first !="".
might loose portability though as I didn't find M4sh macros that expand into a loop and shift is a bashism ...
anyway maybe something to note down for next iteration ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it'd make expand_path_option() a little complicated/messy ... runstatedir seems kind of treated as a special case here about how the values might come from different sources ...

Choose a reason for hiding this comment

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

As said if M4sh had something like AS_WHILE and some abstraction for shift the change would be insignificant and having various sources with an order doesn't sound if it might not be useful for other things on the longer run.

@wenningerk
Copy link

CI is failing because of certificate-issues with some of the builders.
But I guess the ones should be sufficient as a good hint that everything is fine.

@wenningerk wenningerk merged commit 04d90a3 into ClusterLabs:master Oct 14, 2021
@wenningerk
Copy link

@gao-yan

Looks as if overruling --with-runstatedir configuration with what is coming from autoconf via runstatedir might not always be the best idea.
At least on Centos Stream 9 runstatedir passed in via autoconf seems to default to /var/run.
Don't know if that is to be expected or rather a misconfiguration.
For Centos Stream 9 I went with using --runstatedir instead of --with-runstatedir in the config-line.
For upstream we might find something more generic/robust.

@gao-yan
Copy link
Member Author

gao-yan commented Dec 7, 2021

Looks as if overruling --with-runstatedir configuration with what is coming from autoconf via runstatedir might not always be the best idea. At least on Centos Stream 9 runstatedir passed in via autoconf seems to default to /var/run.

Alright, I thought the default would be /run from the new autoconf ...

What's the general packaging convention in regard of this for new RH/Fedora releases? Is --runstatedir supposed to be always explicitly specified for having the modern way? BTW so far autoconf-2.7x hasn't been in any suse distributions yet.

Don't know if that is to be expected or rather a misconfiguration. For Centos Stream 9 I went with using --runstatedir instead of --with-runstatedir in the config-line. For upstream we might find something more generic/robust.

Option --with-runstatedir was introduced for working with old autoconf, but since so far new autoconf doesn't provide an expected default anyway, probably we could somehow make --runstatedir work with any versions of autoconf?

And since pacemaker has the similar, probably this part should better be eventually unified.

@kgaillot
Copy link

kgaillot commented Dec 7, 2021

@wenningerk

At least on Centos Stream 9 runstatedir passed in via autoconf seems to default to /var/run.
Don't know if that is to be expected or rather a misconfiguration.

If the runstatedir default is /var/run on any distro with /run, that's clearly a bug in the autoconf packaging. We should report that, even if we come up with a workaround here

@gao-yan

What's the general packaging convention in regard of this for new RH/Fedora releases? Is --runstatedir supposed to be always explicitly specified for having the modern way? BTW so far autoconf-2.7x hasn't been in any suse distributions yet.

Yes, there's a formal packaging guideline that /run should always be used instead of /var/run (whether via --runstatedir or whatever the upstream offers).

Option --with-runstatedir was introduced for working with old autoconf, but since so far new autoconf doesn't provide an expected default anyway, probably we could somehow make --runstatedir work with any versions of autoconf?

autoconf only allows --with-*/--enable-* for custom options. It might be possible to inspect some of the low-level details but I doubt it's worth the trouble.

Another wrinkle: Debian backported --runstatedir to autoconf 2.69

We could track whether --with-runstatedir was explicitly set or left to default, and override any built-in runstatedir if explicit

@wenningerk
Copy link

If the runstatedir default is /var/run on any distro with /run, that's clearly a bug in the autoconf packaging. We should report that, even if we come up with a workaround here

That is at least what logic would tell. But I didn't research if there is a different convention somehow.

Another wrinkle: Debian backported --runstatedir to autoconf 2.69

Seems to be the case with c9s as well as autoconf is reporting 2.69 there as well.

We could track whether --with-runstatedir was explicitly set or left to default, and override any built-in runstatedir if explicit

Yes, was thinking about that as kind of only way how to handle all versions of autoconf as well.

@wenningerk
Copy link

@gao-yan, @kgaillot

If we assume a packaging bug with the behavior of runstatedir current logic we have in sbd
(have --with-runstatedir overruled by --runstatedir or default runstatedir is set to) should
be fine.
Going further we should - as suggested - report the bug and potentially put a workaround
in place to correct the behavior of sbd for now - as I did for c9s.

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.

4 participants