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
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-setup
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.3.1
Assignee: Yedidyah Bar David
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On:
Blocks:
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:
Environment:
Last Closed: 2014-01-02 13:15:55 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


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