Bug 1502592

Summary: generate-pgpass.sh sources engine-prolog.sh
Product: [oVirt] ovirt-engine Reporter: Yedidyah Bar David <didi>
Component: Setup.EngineAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: bugs, lsvaty, mperina, mvoglova, tnisan
Target Milestone: ovirt-4.1.7Flags: rule-engine: ovirt-4.1+
rule-engine: blocker+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-13 12:27:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1503196    

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