Bug 558515
| Summary: | Agent install and tilde (~) has an unexpected result | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Bryan Kearney <bkearney> |
| Component: | Agent | Assignee: | John Mazzitelli <mazz> |
| Status: | CLOSED NOTABUG | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 1.4.0.B01 | CC: | cwelton |
| Target Milestone: | --- | Keywords: | SubBug |
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2010-09-30 14:37:06 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 565628 | ||
|
Description
Bryan Kearney
2010-01-25 15:21:52 UTC
Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs. keyword: new = Tracking + FutureFeature + SubBug making sure we're not missing any bugs in rhq_triage This may be a dupe - I entered something similar years ago -- perhaps in jbnadm! > I would have expected this to go into my home directory, The reporter's expectation is wrong :) > or to tell me to give a complete path. The installer can install in a relative path. There is nothing wrong with giving a relative or absolute path. So that's a wrong expectation too. (also note: having a "~" character in a filepath is legal and allowed) Now a deeper explanation for why I say the above. First, remember that things like "~" are a shell-construct (e.g. bash recognizes ~ in certain places and replaces it with something like the value of $HOME). It has no special meaning outside of the shell that your console is running and it has no special meaning when "~" appears in certain places in the cmd line. You can see what I'm talking about by doing a simple test with "echo": $ echo --install ~/rhq --install /home/mazz/rhq $ echo --install=~/rhq --install=~/rhq Just as "echo" doesn't replace "~" with /home/mazz in that second invocation, so does our code as well. "echo" has no notion that "~" is a special character to denote the home dir - if you pass a literal "~" to echo, it gets printed as "~". Why does that first invocation show "/home/mazz" in the place of "~" then? With that first invocation, the "~" never makes it to echo in the first place - because the shell replaces it with "/home/mazz" and then passes "/home/mazz" to echo. echo never saw "~". This is the same thing happening here that this issue reports. The problem here is that the argument to the program is literally the string: --install=~/rhq Just as in the echo example above, the tilde character is not recognized by the shell here because its embedded in a string and isn't the first character of the string. Thus the shell won't replace it with the value of $HOME and passes "~" literally to the Java process. And just like echo, our Java code does not assume special status of the "~" and uses it as-is. Only the shell (e.g. bash) gives "~" special meaning, echo does not, Java does not. Note: on Windows, the Windows shell doesn't give "~" this special meaning either. This would work and should be used as a workaround: --install ~/rhq Closing this as NOTABUG. |