[GRADLE-2501] installApp generated shell script is too verbose when performing internal cd Created: 28/Sep/12  Updated: 04/Jan/13  Resolved: 01/Nov/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.2
Fix Version/s: 1.3-rc-1

Type: Bug
Reporter: Gerd Aschemann Assignee: Unassigned
Resolution: Fixed Votes: 0

Attachments: Text File gradle-2501.patch    

 Description   

If the environment variable CDPATH is set any call to the bash internal "cd" will print the new path to standard out if the argument was called with a relative path (to make the user aware of the final directory where he has "cded" to).

This is the case for the generated shell script from the installApp plugin. When calling the generated script by, e.g. "build/install/xxxtool/bin/xxxtool" the first thing it does, is printing something like "/Users/ascheman/wrk/xxxtool/build/install/xxxtool" which is not expected by the user.

This can be fixed by changing the following line in the generated shell script

cd "`dirname \"$PRG\"`/.."

to

cd "`dirname \"$PRG\"`/.." >&-

to make it print the message to /dev/null.

(This is a common error which can be seen in a lot of bash scripts since only few people are aware of the "cd" command behaviour when the convenience variable CDPATH is set).



 Comments   
Comment by Gerd Aschemann [ 28/Sep/12 ]

Here is a patch to fix the problem ...

Generated at Wed Jun 30 12:23:41 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.