Bug 1044483 - [engine-setup] engine-setup --generate-answer expands wrongly '~' in file path
Summary: [engine-setup] engine-setup --generate-answer expands wrongly '~' in file path
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 3.3.1
Assignee: Yedidyah Bar David
QA Contact: Pavel Stehlik
Whiteboard: integration
Depends On:
TreeView+ depends on / blocked
Reported: 2013-12-18 12:08 UTC by Jiri Belka
Modified: 2014-01-02 13:15 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-01-02 13:15:55 UTC
oVirt Team: ---
Target Upstream Version:

Attachments (Terms of Use)

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

# engine-setup --generate-answer=~/lol
[ 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):

How reproducible:

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

Actual results:

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.

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