Bug 1502592 - generate-pgpass.sh sources engine-prolog.sh
Summary: generate-pgpass.sh sources engine-prolog.sh
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Setup.Engine
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.1.7
: ---
Assignee: Yedidyah Bar David
QA Contact: Jiri Belka
URL:
Whiteboard:
Depends On:
Blocks: 1503196
TreeView+ depends on / blocked
 
Reported: 2017-10-16 09:54 UTC by Yedidyah Bar David
Modified: 2017-11-13 12:27 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-11-13 12:27:46 UTC
oVirt Team: Integration
Embargoed:
rule-engine: ovirt-4.1+
rule-engine: blocker+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 82641 0 None None None 2017-10-16 09:56:21 UTC
oVirt gerrit 82800 0 ovirt-engine-4.1 MERGED packaging: bin: Source engine-prolog.sh directly 2017-10-16 11:28:59 UTC
oVirt gerrit 82871 0 ovirt-engine-4.0 ABANDONED packaging: bin: Add generate-pgpass.sh 2017-10-17 11:51:37 UTC

Description Yedidyah Bar David 2017-10-16 09:54:22 UTC
Description of problem:

generate-pgpass.sh is a file that's intended to be sourced by other scripts.
It sources engine-prolog.sh, using a path relative to $0.

This breaks when the scripts sourcing generate-pgpass.sh are in different directories, because $0 is the path of these scripts, not of generate-pgpass.sh.

4.1 is not affected directly, because only a single file sources generate-pgpass.sh there. But we want to source it from other scripts during the upgrade to 4.2, where generate-pgpass.sh is still in 4.1 (before the upgrade), thus we want to fix this bug for 4.1.

In 4.2 it's already fixed by:

https://gerrit.ovirt.org/82641

Comment 1 Yedidyah Bar David 2017-10-16 09:58:30 UTC
The patch referenced in comment 0 also renames the 'cleanup' function, intending to prevent future collisions with such functions in scripts using it. Not sure this is enough, because 'trap' will only run the last argument. Still thinking whether all of this is the right approach, not sure.

Comment 2 Martin Perina 2017-10-16 10:09:39 UTC
(In reply to Yedidyah Bar David from comment #1)
> The patch referenced in comment 0 also renames the 'cleanup' function,
> intending to prevent future collisions with such functions in scripts using
> it. Not sure this is enough, because 'trap' will only run the last argument.
> Still thinking whether all of this is the right approach, not sure.

There is also comment in the generate-pgpass.sh that if some script is including generate-pgpass.sh and reusing trap, they should include calling of pgPassCleanup into their own trap function. AFAIK you cannot register multiple function within the trap call, so do you think there is some better way how to handle that?

Comment 3 Jiri Belka 2017-10-20 14:37:21 UTC
ok, ovirt-engine-tools-4.1.7.4-0.1.el7.noarch

- clean install successful
- upgrade with vacuum successful


Note You need to log in before you can comment on or make changes to this bug.