You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Oliver Schrenk <ol...@gmail.com> on 2011/01/26 16:36:12 UTC

Keeping the executable bit on shell scripts when testing

Hi,

I have several shell scripts in src/test/resources that I try to call from within a JUnit test. The class under test is a wrapper arround plexus.utils.cli.

When mvn copies the files to target/test-classes the executable bits are lost and the test fails due missing authorization.

Any way to keep them? Or any other ideas?

Best regards
Oliver Schrenk
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Keeping the executable bit on shell scripts when testing

Posted by Oliver Schrenk <ol...@gmail.com>.
No. That works fine. Its the application logic that get's in the way. Maybe I find a workaround using `sh` but it'll be a few days I have time to work on it again.

Thanks.

Best regards
Oliver

PS Throwing a crazy idea out there: Java7 rewrite for Maven using JSR203 accessing POSIX file permissions

 

Am 27.01.2011 um 19:42 schrieb Haszlakiewicz, Eric:

>> -----Original Message-----
>> From: Oliver Schrenk [mailto:oliver.schrenk@gmail.com]
>> 
>> It's a good idea but not suitable for my case. If I'm calling sh, the real
>> script would be an argument.In my case this would break the test cases for
>> my command line argument validation tool.
> 
> cat > aa.sh <<EOF
> #!/bin/sh
> echo 0:$0
> echo 1:$1
> EOF
>> chmod +x aa.sh
>> ./aa.sh
> 0:./aa.sh
> 1:
>> ./aa.sh a
> 0:./aa.sh
> 1:a
>> sh ./aa.sh a
> 0:./aa.sh
> 1:a
> 
> That looks exactly the same to me.  What kind of shell are you using that breaks this?
> 
> eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Keeping the executable bit on shell scripts when testing

Posted by "Haszlakiewicz, Eric" <EH...@transunion.com>.
>-----Original Message-----
>From: Oliver Schrenk [mailto:oliver.schrenk@gmail.com]
>
>It's a good idea but not suitable for my case. If I'm calling sh, the real
>script would be an argument.In my case this would break the test cases for
>my command line argument validation tool.

cat > aa.sh <<EOF
#!/bin/sh
echo 0:$0
echo 1:$1
EOF
> chmod +x aa.sh
> ./aa.sh
0:./aa.sh
1:
> ./aa.sh a
0:./aa.sh
1:a
> sh ./aa.sh a
0:./aa.sh
1:a

That looks exactly the same to me.  What kind of shell are you using that breaks this?

eric


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Keeping the executable bit on shell scripts when testing

Posted by Oliver Schrenk <ol...@gmail.com>.
It's a good idea but not suitable for my case. If I'm calling sh, the real script would be an argument.In my case this would break the test cases for my command line argument validation tool.


Am 26.01.2011 um 21:03 schrieb Kathryn Huxtable:

> That's a reasonable workaround.
> 
> I think it's a reasonable thing to expect permissions on files to be preserved. Consider this a +1 for a feature enhancement.
> 
> -K
> 
> On Jan 26, 2011, at 11:04 AM, Stephen Connolly wrote:
> 
>> launch them with sh as the prefix on the cli, eg
>> 
>> sh foo.sh
>> 
>> and not
>> 
>> foo.sh
>> 
>> - Stephen
>> 
>> ---
>> Sent from my Android phone, so random spelling mistakes, random nonsense
>> words and other nonsense are a direct result of using swype to type on the
>> screen
>> On 26 Jan 2011 15:36, "Oliver Schrenk" <ol...@gmail.com> wrote:
>>> Hi,
>>> 
>>> I have several shell scripts in src/test/resources that I try to call from
>> within a JUnit test. The class under test is a wrapper arround
>> plexus.utils.cli.
>>> 
>>> When mvn copies the files to target/test-classes the executable bits are
>> lost and the test fails due missing authorization.
>>> 
>>> Any way to keep them? Or any other ideas?
>>> 
>>> Best regards
>>> Oliver Schrenk
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Keeping the executable bit on shell scripts when testing

Posted by Kathryn Huxtable <ka...@kathrynhuxtable.org>.
That's a reasonable workaround.

I think it's a reasonable thing to expect permissions on files to be preserved. Consider this a +1 for a feature enhancement.

-K

On Jan 26, 2011, at 11:04 AM, Stephen Connolly wrote:

> launch them with sh as the prefix on the cli, eg
> 
> sh foo.sh
> 
> and not
> 
> foo.sh
> 
> - Stephen
> 
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 26 Jan 2011 15:36, "Oliver Schrenk" <ol...@gmail.com> wrote:
>> Hi,
>> 
>> I have several shell scripts in src/test/resources that I try to call from
> within a JUnit test. The class under test is a wrapper arround
> plexus.utils.cli.
>> 
>> When mvn copies the files to target/test-classes the executable bits are
> lost and the test fails due missing authorization.
>> 
>> Any way to keep them? Or any other ideas?
>> 
>> Best regards
>> Oliver Schrenk
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Keeping the executable bit on shell scripts when testing

Posted by Stephen Connolly <st...@gmail.com>.
launch them with sh as the prefix on the cli, eg

sh foo.sh

and not

foo.sh

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 26 Jan 2011 15:36, "Oliver Schrenk" <ol...@gmail.com> wrote:
> Hi,
>
> I have several shell scripts in src/test/resources that I try to call from
within a JUnit test. The class under test is a wrapper arround
plexus.utils.cli.
>
> When mvn copies the files to target/test-classes the executable bits are
lost and the test fails due missing authorization.
>
> Any way to keep them? Or any other ideas?
>
> Best regards
> Oliver Schrenk
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>