Bug 1044483

Summary: [engine-setup] engine-setup --generate-answer expands wrongly '~' in file path
Product: Red Hat Enterprise Virtualization Manager Reporter: Jiri Belka <jbelka>
Component: ovirt-engine-setupAssignee: Yedidyah Bar David <didi>
Status: CLOSED NOTABUG QA Contact: Pavel Stehlik <pstehlik>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acathrow, bazulay, iheim, Rhev-m-bugs, yeylon
Target Milestone: ---   
Target Release: 3.3.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: integration
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-02 13:15:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Belka 2013-12-18 12:08:30 UTC
Description of problem:

# engine-setup --generate-answer=~/lol
...snip...
[ INFO  ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20131218130329-upgrade.conf'
[ INFO  ] Generating answer file '~/lol'
[ ERROR ] Failed to execute stage 'Closing up': [Errno 2] No such file or directory: '/root/~/lol'
[ INFO  ] Stage: Clean up
          Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20131218130111.log
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination
[ ERROR ] Execution of upgrade failed
# ls -l ~/lol
ls: cannot access /root/lol: No such file or directory

Version-Release number of selected component (if applicable):
is27

How reproducible:
100%

Steps to Reproduce:
1. engine-setup --generate-answer=~/lol
2.
3.

Actual results:
failure

Expected results:
lol exists

Additional info:
or maybe engine-setup does not like funny filenames? :)))

Comment 1 Jiri Belka 2013-12-18 12:14:05 UTC
fyi, it was ran when rhevm was already fully setup, i mean: engine-setup, engine-setup again...

Comment 2 Yedidyah Bar David 2014-01-02 13:15:55 UTC
~ is expanded by the shell, if at all, and is not the job of engine-setup (or most any other program).

I now checked and saw that bash (at least my version) expands things like
echo a=~/b
but does not expand things like
echo --a=~/b
Not sure why. Other shells differ in this behavior as well (also from bash) - tried dash and posh.

engnie-setup fails, in this case, because it tries to write to a file ~/lol, which without tilde expansion is interpreted as the file "lol" inside a directory named "~". If you do
mkdir "~"
and then run engine-setup as you tried, it will work. Probably not what you wanted, though. You'll get the same error if you do e.g.
engine-setup --generate-answer=/tmp/dir1/file1
if /tmp/dir1 does not exist.