public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [Fwd: Re: perl test fails]
@ 2003-08-29  9:57 Rob Clack
  2003-08-29 10:09 ` Elfyn McBratney
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Clack @ 2003-08-29  9:57 UTC (permalink / raw)
  To: cygwin

Well I thought maybe I'd better just try setting $CYGWIN, even though it 
didn't seem relevant (I don't  have "..problems with NT shares or Samba 
drives..", since the script reliably breaks when run from a local, 
non-shared drive) and indeed, it made no difference.  Unless there's 
some special way I should be setting it.  I just entered 
CYGWIN=nosmbntsec at the dollar prompt.

OK, so if I assume by the silence that -x is broken, can anyone suggest 
how I can determine in a perl script whether or not a file is executable?

Thanks
Rob

------------- hyphens to separate this from previous posts -------------

Thank you Igor.  However, I've now read the entry on smbntsec and it
doesn't seem relevant.  (Was a useful exercise in itself, since I didn't
know about the CYGWIN env var either ;)) I don't have a problem on the
Linux box, only on the NT one. And it doesn't matter whether I'm running
the script from the networked drive or from the local hard drive, I only
get the error under Cygwin.

So far it keeps looking to me as though Cygwin is broken.

Rob

Igor Pechtchanski wrote:
> On Wed, 27 Aug 2003, Rob Clack wrote:
> 
> 
>>Hmmm, don't see how it can have anything to do with the mapping of a
>>networked drive, since the problem started on the NT4 box, at which time
>>the scriptlet was located in /cygdrive/e/cygwin/rnc/try.
>>
>>Since I wanted to demonstrate that it worked on the Linux box (having
>>tripped over that one originally!)  each time I hacked one copy of the
>>script I then had to move to the other machine and duplicate the changes
>>I'd just made.  Clearly this was error-prone, so it made sense to just
>>use the copy on the Linux box.  On the NT4 it's accessible as
>>/cygdrive/i/rnc/try.
> 
> 
> Rob,
> 
> Well, it's usually a good idea to keep as many variables fixed as
> possible.  By sharing the script, you've unknowingly introduced another
> variable (that of SMB shares).  I'd suggest moving the script back to a
> local directory, and simply copying it to the shared drive when you want
> to try it on Linux.  That way you can reliably reproduce the problem on
> the local drive.
> 
> 
>>And no, I've never heard of smbntsec.  What's it mean/do?
> 
> 
> See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>.  It's on by
> default.  FYI, it may require very careful hand-maintenance of /etc/passwd
> and /etc/group (in fact, I've ended up turning it off because the
> maintenance effort wasn't worth it for me).  You might wish to add
> "nosmbntsec" to your CYGWIN variable.
> 	Igor
> 
> 
>>Regards
>>Rob
>>
>>Larry Hall wrote:
>>
>>>At 09:36 AM 8/26/2003, Rob Clack you wrote:
>>>
>>>
>>>>Gerrit
>>>>
>>>>I've been away for a week, hence the delayed response.
>>>>
>>>>Thanks for this and clearly my scriptlet was broken.  I've now tried both alternatives as suggested below.  Both work perfectly under Linux.  Neither works under NT4.
>>>>
>>>>Linux output:
>>>>
>>>>script is executable
>>>>
>>>>NT4 output:
>>>>
>>>>I damn well am!
>>>>
>>>>To eliminate error further, I'm now running just one copy of the script, since the disk I use on my Linux box is mapped to the i: drive on the NT4 box.
>>>
>>>
>>>
>>>Are you suggesting that you're using a mapped drive from your Linux box?
>>>That may be the problem.  Do you have 'smbntsec' set in your CYGWIN
>>>environment variable?
>>>
>>>
>>>
>>>Larry Hall                              http://www.rfk.com
>>>RFK Partners, Inc.                      (508) 893-9779 - RFK Office
>>>838 Washington Street                   (508) 893-9889 - FAX
>>>Holliston, MA 01746
> 
> 

-- 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   You're only young once, but you can stay immature as long as you like.
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Rob Clack                        Acedb Development,  Informatics Group
   email: rnc@sanger.ac.uk                Wellcome Trust Sanger Institute
   Tel: +44 1223 494780                   Wellcome Trust Genome Campus
   Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


-- 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Middle age is when broadness of mind and narrowness
  of waist change places.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc@sanger.ac.uk                Wellcome Trust Sanger Institute
  Tel: +44 1223 494780                   Wellcome Trust Genome Campus
  Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
  2003-08-29  9:57 [Fwd: Re: perl test fails] Rob Clack
@ 2003-08-29 10:09 ` Elfyn McBratney
  2003-08-29 10:45   ` Rob Clack
  0 siblings, 1 reply; 7+ messages in thread
From: Elfyn McBratney @ 2003-08-29 10:09 UTC (permalink / raw)
  To: cygwin

Rob Clack wrote:
> Well I thought maybe I'd better just try setting $CYGWIN, even though it 
> didn't seem relevant (I don't  have "..problems with NT shares or Samba 
> drives..", since the script reliably breaks when run from a local, 
> non-shared drive) and indeed, it made no difference.  Unless there's 
> some special way I should be setting it.  I just entered 
> CYGWIN=nosmbntsec at the dollar prompt.
> 
> OK, so if I assume by the silence that -x is broken, can anyone suggest 
> how I can determine in a perl script whether or not a file is executable?

The `-x' operator WFM.  Does, say, this script fail for you (make sure perl
is *actually* executable) ?

  #!/usr/bin/perl

  if (-x "/usr/bin/perl") {
    print "yupp, perl is executable.\n";
  } else {
    print "ut-oh! perl isn't executable.\n";
  }

If you haven't already posted cygcheck[1] output, that might help, and also
post your script (I couldn't find it in my archives).  Sorry if you've
already done this.

-- Elfyn

[1] non-inline, plain-text attachment, as per <http://cygwin.com/problems.html>

> ------------- hyphens to separate this from previous posts -------------
> 
> Thank you Igor.  However, I've now read the entry on smbntsec and it
> doesn't seem relevant.  (Was a useful exercise in itself, since I didn't
> know about the CYGWIN env var either ;)) I don't have a problem on the
> Linux box, only on the NT one. And it doesn't matter whether I'm running
> the script from the networked drive or from the local hard drive, I only
> get the error under Cygwin.
> 
> So far it keeps looking to me as though Cygwin is broken.
> 
> Igor Pechtchanski wrote:
> >On Wed, 27 Aug 2003, Rob Clack wrote:
> >
> >>Hmmm, don't see how it can have anything to do with the mapping of a
> >>networked drive, since the problem started on the NT4 box, at which time
> >>the scriptlet was located in /cygdrive/e/cygwin/rnc/try.
> >>
> >>Since I wanted to demonstrate that it worked on the Linux box (having
> >>tripped over that one originally!)  each time I hacked one copy of the
> >>script I then had to move to the other machine and duplicate the changes
> >>I'd just made.  Clearly this was error-prone, so it made sense to just
> >>use the copy on the Linux box.  On the NT4 it's accessible as
> >>/cygdrive/i/rnc/try.
> >
> >Rob,
> >
> >Well, it's usually a good idea to keep as many variables fixed as
> >possible.  By sharing the script, you've unknowingly introduced another
> >variable (that of SMB shares).  I'd suggest moving the script back to a
> >local directory, and simply copying it to the shared drive when you want
> >to try it on Linux.  That way you can reliably reproduce the problem on
> >the local drive.
> >
> >>And no, I've never heard of smbntsec.  What's it mean/do?
> >
> >See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>.  It's on by
> >default.  FYI, it may require very careful hand-maintenance of /etc/passwd
> >and /etc/group (in fact, I've ended up turning it off because the
> >maintenance effort wasn't worth it for me).  You might wish to add
> >"nosmbntsec" to your CYGWIN variable.
> >	Igor
> >>
> >>>At 09:36 AM 8/26/2003, Rob Clack you wrote:
> >>>
> >>>
> >>>>Gerrit
> >>>>
> >>>>I've been away for a week, hence the delayed response.
> >>>>
> >>>>Thanks for this and clearly my scriptlet was broken.  I've now tried 
> >>>>both alternatives as suggested below.  Both work perfectly under Linux. 
> >>>>Neither works under NT4.
> >>>>
> >>>>Linux output:
> >>>>
> >>>>script is executable
> >>>>
> >>>>NT4 output:
> >>>>
> >>>>I damn well am!
> >>>>
> >>>>To eliminate error further, I'm now running just one copy of the 
> >>>>script, since the disk I use on my Linux box is mapped to the i: drive 
> >>>>on the NT4 box.
> >>>
> >>>Are you suggesting that you're using a mapped drive from your Linux box?
> >>>That may be the problem.  Do you have 'smbntsec' set in your CYGWIN
> >>>environment variable?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
  2003-08-29 10:09 ` Elfyn McBratney
@ 2003-08-29 10:45   ` Rob Clack
  2003-08-29 11:11     ` Elfyn McBratney
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Clack @ 2003-08-29 10:45 UTC (permalink / raw)
  To: cygwin

Hooray, we're there!  Thank you!

The -x operator works perfectly, but the problem was still rather 
obscure, so here's the answer.

Cygwin 1.3.22-1 under NT4, Perl 5.8.0

My script was almost identical to the one Elfyn supplied below, it just 
tested a local file rather than /usr/bin/perl.

#!/bin/perl

if ( -x "script" )
{
   print "script is executable\n";
}
else
{
   system("./script");
}


This local file was a one-liner containing only

echo "I damn well am!"

I had chmod +x this file and when I ran either it or my perl script at 
the command prompt I got the output "I damn well am!", indicating that 
the -x operator considered the file to be not executable, but the file 
itself could, actually, be executed.

But Elfyn's script worked, and mine didn't, so I started poking around.

To my surprise I found that the local file had 644 permissions, not 744 
as I'd expected.  I chmod +x it again, but the permissions didn't 
change, though I could still run it and get the echoed output. I tried 
chmod 777, still with no effect.  Only when I added a first line 
#!/bin/bash would chmod +x work, after which my perl script worked just 
like Elfyn's

So there seems to be a couple of weensy buggettes there, though I'm not 
suggesting anyone bother to fix them unless they happen to be working 
there anyway.  They're not serious bugs, but they did obscure the real 
problem and waste quite a lot of my and several other people's time.

1. chmod should surely change the permissions whatever the contents of 
the file, and if it doesn't, it should issue a message.  Silent failure 
is not very friendly.

2. a file without execute permission shouldn't execute.

Anyhow, thanks for all the responses.
Rob

Elfyn McBratney wrote:
> Rob Clack wrote:
> 
>>Well I thought maybe I'd better just try setting $CYGWIN, even though it 
>>didn't seem relevant (I don't  have "..problems with NT shares or Samba 
>>drives..", since the script reliably breaks when run from a local, 
>>non-shared drive) and indeed, it made no difference.  Unless there's 
>>some special way I should be setting it.  I just entered 
>>CYGWIN=nosmbntsec at the dollar prompt.
>>
>>OK, so if I assume by the silence that -x is broken, can anyone suggest 
>>how I can determine in a perl script whether or not a file is executable?
> 
> 
> The `-x' operator WFM.  Does, say, this script fail for you (make sure perl
> is *actually* executable) ?
> 
>   #!/usr/bin/perl
> 
>   if (-x "/usr/bin/perl") {
>     print "yupp, perl is executable.\n";
>   } else {
>     print "ut-oh! perl isn't executable.\n";
>   }
> 
> If you haven't already posted cygcheck[1] output, that might help, and also
> post your script (I couldn't find it in my archives).  Sorry if you've
> already done this.
> 
> -- Elfyn
> 
> [1] non-inline, plain-text attachment, as per <http://cygwin.com/problems.html>
> 
>>------------- hyphens to separate this from previous posts -------------
>>
>>Thank you Igor.  However, I've now read the entry on smbntsec and it
>>doesn't seem relevant.  (Was a useful exercise in itself, since I didn't
>>know about the CYGWIN env var either ;)) I don't have a problem on the
>>Linux box, only on the NT one. And it doesn't matter whether I'm running
>>the script from the networked drive or from the local hard drive, I only
>>get the error under Cygwin.
>>
>>So far it keeps looking to me as though Cygwin is broken.
>>
>>Igor Pechtchanski wrote:
>>
>>>On Wed, 27 Aug 2003, Rob Clack wrote:
>>>
>>>
>>>>Hmmm, don't see how it can have anything to do with the mapping of a
>>>>networked drive, since the problem started on the NT4 box, at which time
>>>>the scriptlet was located in /cygdrive/e/cygwin/rnc/try.
>>>>
>>>>Since I wanted to demonstrate that it worked on the Linux box (having
>>>>tripped over that one originally!)  each time I hacked one copy of the
>>>>script I then had to move to the other machine and duplicate the changes
>>>>I'd just made.  Clearly this was error-prone, so it made sense to just
>>>>use the copy on the Linux box.  On the NT4 it's accessible as
>>>>/cygdrive/i/rnc/try.
>>>
>>>Rob,
>>>
>>>Well, it's usually a good idea to keep as many variables fixed as
>>>possible.  By sharing the script, you've unknowingly introduced another
>>>variable (that of SMB shares).  I'd suggest moving the script back to a
>>>local directory, and simply copying it to the shared drive when you want
>>>to try it on Linux.  That way you can reliably reproduce the problem on
>>>the local drive.
>>>
>>>
>>>>And no, I've never heard of smbntsec.  What's it mean/do?
>>>
>>>See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>.  It's on by
>>>default.  FYI, it may require very careful hand-maintenance of /etc/passwd
>>>and /etc/group (in fact, I've ended up turning it off because the
>>>maintenance effort wasn't worth it for me).  You might wish to add
>>>"nosmbntsec" to your CYGWIN variable.
>>>	Igor
>>>
>>>>>At 09:36 AM 8/26/2003, Rob Clack you wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Gerrit
>>>>>>
>>>>>>I've been away for a week, hence the delayed response.
>>>>>>
>>>>>>Thanks for this and clearly my scriptlet was broken.  I've now tried 
>>>>>>both alternatives as suggested below.  Both work perfectly under Linux. 
>>>>>>Neither works under NT4.
>>>>>>
>>>>>>Linux output:
>>>>>>
>>>>>>script is executable
>>>>>>
>>>>>>NT4 output:
>>>>>>
>>>>>>I damn well am!
>>>>>>
>>>>>>To eliminate error further, I'm now running just one copy of the 
>>>>>>script, since the disk I use on my Linux box is mapped to the i: drive 
>>>>>>on the NT4 box.
>>>>>
>>>>>Are you suggesting that you're using a mapped drive from your Linux box?
>>>>>That may be the problem.  Do you have 'smbntsec' set in your CYGWIN
>>>>>environment variable?
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

-- 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Middle age is when broadness of mind and narrowness
  of waist change places.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc@sanger.ac.uk                Wellcome Trust Sanger Institute
  Tel: +44 1223 494780                   Wellcome Trust Genome Campus
  Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
  2003-08-29 10:45   ` Rob Clack
@ 2003-08-29 11:11     ` Elfyn McBratney
  2003-08-29 13:41       ` Rob Clack
  0 siblings, 1 reply; 7+ messages in thread
From: Elfyn McBratney @ 2003-08-29 11:11 UTC (permalink / raw)
  To: cygwin

Rob Clack wrote:
> [...] 
> So there seems to be a couple of weensy buggettes there, though I'm not 
> suggesting anyone bother to fix them unless they happen to be working 
> there anyway.  They're not serious bugs, but they did obscure the real 
> problem and waste quite a lot of my and several other people's time.
> 
> 1. chmod should surely change the permissions whatever the contents of 
> the file, and if it doesn't, it should issue a message.  Silent failure 
> is not very friendly.

If your on an NT variant all you have to do is set CYGWIN=ntsec (If you want
support for NT extended attributes you can add `ntea', too).  However, on
win9x the `ch*' family of calls retrun success (IIRC), as the underlying OS
does not support security in the way NT does.  I might be slightly wrong about
the win9x but, though it's documented in either the User's Guide of the FAQ.

You can then use `ch{mod,own,grp}' in the same way you would on Linux.

-- Elfyn

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
  2003-08-29 11:11     ` Elfyn McBratney
@ 2003-08-29 13:41       ` Rob Clack
  2003-08-29 16:01         ` Igor Pechtchanski
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Clack @ 2003-08-29 13:41 UTC (permalink / raw)
  To: cygwin

Thank you Elfyn and Jurgen.  A few moment's thought would have reminded 
me that file permissions are handled differently on NT. ;)

Regards
Rob

Elfyn McBratney wrote:
> Rob Clack wrote:
> 
>>[...] 
>>So there seems to be a couple of weensy buggettes there, though I'm not 
>>suggesting anyone bother to fix them unless they happen to be working 
>>there anyway.  They're not serious bugs, but they did obscure the real 
>>problem and waste quite a lot of my and several other people's time.
>>
>>1. chmod should surely change the permissions whatever the contents of 
>>the file, and if it doesn't, it should issue a message.  Silent failure 
>>is not very friendly.
> 
> 
> If your on an NT variant all you have to do is set CYGWIN=ntsec (If you want
> support for NT extended attributes you can add `ntea', too).  However, on
> win9x the `ch*' family of calls retrun success (IIRC), as the underlying OS
> does not support security in the way NT does.  I might be slightly wrong about
> the win9x but, though it's documented in either the User's Guide of the FAQ.
> 
> You can then use `ch{mod,own,grp}' in the same way you would on Linux.
> 
> -- Elfyn
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

-- 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Middle age is when broadness of mind and narrowness
  of waist change places.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc@sanger.ac.uk                Wellcome Trust Sanger Institute
  Tel: +44 1223 494780                   Wellcome Trust Genome Campus
  Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
  2003-08-29 13:41       ` Rob Clack
@ 2003-08-29 16:01         ` Igor Pechtchanski
  0 siblings, 0 replies; 7+ messages in thread
From: Igor Pechtchanski @ 2003-08-29 16:01 UTC (permalink / raw)
  To: Rob Clack; +Cc: cygwin

Rob,

Actually, this behavior also depends on the filesystem you use.
CYGWIN=ntsec alone only helps if you have NTFS.  For FAT you also need
"ntea" (i.e., CYGWIN="ntsec ntea" -- be aware that it'll create a large
file in your drive's root directory).  I believe permissions on FAT32 were
broken somehow, but don't recall the details -- just search the archives
for "FAT32 ntea".
	Igor

On Fri, 29 Aug 2003, Rob Clack wrote:

> Thank you Elfyn and Jurgen.  A few moment's thought would have reminded
> me that file permissions are handled differently on NT. ;)
>
> Regards
> Rob
>
> Elfyn McBratney wrote:
> > Rob Clack wrote:
> >
> >>[...]
> >>So there seems to be a couple of weensy buggettes there, though I'm not
> >>suggesting anyone bother to fix them unless they happen to be working
> >>there anyway.  They're not serious bugs, but they did obscure the real
> >>problem and waste quite a lot of my and several other people's time.
> >>
> >>1. chmod should surely change the permissions whatever the contents of
> >>the file, and if it doesn't, it should issue a message.  Silent failure
> >>is not very friendly.
> >
> >
> > If your on an NT variant all you have to do is set CYGWIN=ntsec (If you want
> > support for NT extended attributes you can add `ntea', too).  However, on
> > win9x the `ch*' family of calls retrun success (IIRC), as the underlying OS
> > does not support security in the way NT does.  I might be slightly wrong about
> > the win9x but, though it's documented in either the User's Guide of the FAQ.
> >
> > You can then use `ch{mod,own,grp}' in the same way you would on Linux.
> >
> > -- Elfyn

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Fwd: Re: perl test fails]
@ 2003-08-29 11:02 jurgen.defurne
  0 siblings, 0 replies; 7+ messages in thread
From: jurgen.defurne @ 2003-08-29 11:02 UTC (permalink / raw)
  Cc: cygwin

Hello, Rob,

export CYGWIN="ntsec"

If you do not do that, then all your files will have default
mode 644.

Your file did not change because you do chmod +x,
but because you added the line #!/usr/bin/perl to
it.

Regards,

Jurgen










Rob Clack <rnc@sanger.ac.uk>
Sent by: 
cygwin-owner@cygwin.com
08/29/2003 12:33 PM

 
        To:     cygwin@cygwin.com
        cc:     (bcc: Jurgen Defurne/BRG/CE/PHILIPS)
        Subject:        Re: [Fwd: Re: perl test fails]
        Classification: 



Hooray, we're there!  Thank you!

The -x operator works perfectly, but the problem was still rather 
obscure, so here's the answer.

Cygwin 1.3.22-1 under NT4, Perl 5.8.0

My script was almost identical to the one Elfyn supplied below, it just 
tested a local file rather than /usr/bin/perl.

#!/bin/perl

if ( -x "script" )
{
   print "script is executable\n";
}
else
{
   system("./script");
}


This local file was a one-liner containing only

echo "I damn well am!"

I had chmod +x this file and when I ran either it or my perl script at 
the command prompt I got the output "I damn well am!", indicating that 
the -x operator considered the file to be not executable, but the file 
itself could, actually, be executed.

But Elfyn's script worked, and mine didn't, so I started poking around.

To my surprise I found that the local file had 644 permissions, not 744 
as I'd expected.  I chmod +x it again, but the permissions didn't 
change, though I could still run it and get the echoed output. I tried 
chmod 777, still with no effect.  Only when I added a first line 
#!/bin/bash would chmod +x work, after which my perl script worked just 
like Elfyn's

So there seems to be a couple of weensy buggettes there, though I'm not 
suggesting anyone bother to fix them unless they happen to be working 
there anyway.  They're not serious bugs, but they did obscure the real 
problem and waste quite a lot of my and several other people's time.

1. chmod should surely change the permissions whatever the contents of 
the file, and if it doesn't, it should issue a message.  Silent failure 
is not very friendly.

2. a file without execute permission shouldn't execute.

Anyhow, thanks for all the responses.
Rob

Elfyn McBratney wrote:
> Rob Clack wrote:
> 
>>Well I thought maybe I'd better just try setting $CYGWIN, even though it 

>>didn't seem relevant (I don't  have "..problems with NT shares or Samba 
>>drives..", since the script reliably breaks when run from a local, 
>>non-shared drive) and indeed, it made no difference.  Unless there's 
>>some special way I should be setting it.  I just entered 
>>CYGWIN=nosmbntsec at the dollar prompt.
>>
>>OK, so if I assume by the silence that -x is broken, can anyone suggest 
>>how I can determine in a perl script whether or not a file is 
executable?
> 
> 
> The `-x' operator WFM.  Does, say, this script fail for you (make sure 
perl
> is *actually* executable) ?
> 
>   #!/usr/bin/perl
> 
>   if (-x "/usr/bin/perl") {
>     print "yupp, perl is executable.\n";
>   } else {
>     print "ut-oh! perl isn't executable.\n";
>   }
> 
> If you haven't already posted cygcheck[1] output, that might help, and 
also
> post your script (I couldn't find it in my archives).  Sorry if you've
> already done this.
> 
> -- Elfyn
> 
> [1] non-inline, plain-text attachment, as per <http://cygwin.com/problems.html>
> 
>>------------- hyphens to separate this from previous posts -------------
>>
>>Thank you Igor.  However, I've now read the entry on smbntsec and it
>>doesn't seem relevant.  (Was a useful exercise in itself, since I didn't
>>know about the CYGWIN env var either ;)) I don't have a problem on the
>>Linux box, only on the NT one. And it doesn't matter whether I'm running
>>the script from the networked drive or from the local hard drive, I only
>>get the error under Cygwin.
>>
>>So far it keeps looking to me as though Cygwin is broken.
>>
>>Igor Pechtchanski wrote:
>>
>>>On Wed, 27 Aug 2003, Rob Clack wrote:
>>>
>>>
>>>>Hmmm, don't see how it can have anything to do with the mapping of a
>>>>networked drive, since the problem started on the NT4 box, at which 
time
>>>>the scriptlet was located in /cygdrive/e/cygwin/rnc/try.
>>>>
>>>>Since I wanted to demonstrate that it worked on the Linux box (having
>>>>tripped over that one originally!)  each time I hacked one copy of the
>>>>script I then had to move to the other machine and duplicate the 
changes
>>>>I'd just made.  Clearly this was error-prone, so it made sense to just
>>>>use the copy on the Linux box.  On the NT4 it's accessible as
>>>>/cygdrive/i/rnc/try.
>>>
>>>Rob,
>>>
>>>Well, it's usually a good idea to keep as many variables fixed as
>>>possible.  By sharing the script, you've unknowingly introduced another
>>>variable (that of SMB shares).  I'd suggest moving the script back to a
>>>local directory, and simply copying it to the shared drive when you 
want
>>>to try it on Linux.  That way you can reliably reproduce the problem on
>>>the local drive.
>>>
>>>
>>>>And no, I've never heard of smbntsec.  What's it mean/do?
>>>
>>>See <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>.  It's on by
>>>default.  FYI, it may require very careful hand-maintenance of 
/etc/passwd
>>>and /etc/group (in fact, I've ended up turning it off because the
>>>maintenance effort wasn't worth it for me).  You might wish to add
>>>"nosmbntsec" to your CYGWIN variable.
>>>              Igor
>>>
>>>>>At 09:36 AM 8/26/2003, Rob Clack you wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Gerrit
>>>>>>
>>>>>>I've been away for a week, hence the delayed response.
>>>>>>
>>>>>>Thanks for this and clearly my scriptlet was broken.  I've now tried 

>>>>>>both alternatives as suggested below.  Both work perfectly under 
Linux. 
>>>>>>Neither works under NT4.
>>>>>>
>>>>>>Linux output:
>>>>>>
>>>>>>script is executable
>>>>>>
>>>>>>NT4 output:
>>>>>>
>>>>>>I damn well am!
>>>>>>
>>>>>>To eliminate error further, I'm now running just one copy of the 
>>>>>>script, since the disk I use on my Linux box is mapped to the i: 
drive 
>>>>>>on the NT4 box.
>>>>>
>>>>>Are you suggesting that you're using a mapped drive from your Linux 
box?
>>>>>That may be the problem.  Do you have 'smbntsec' set in your CYGWIN
>>>>>environment variable?
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

-- 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Middle age is when broadness of mind and narrowness
  of waist change places.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc@sanger.ac.uk                Wellcome Trust Sanger Institute
  Tel: +44 1223 494780                   Wellcome Trust Genome Campus
  Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-08-29 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29  9:57 [Fwd: Re: perl test fails] Rob Clack
2003-08-29 10:09 ` Elfyn McBratney
2003-08-29 10:45   ` Rob Clack
2003-08-29 11:11     ` Elfyn McBratney
2003-08-29 13:41       ` Rob Clack
2003-08-29 16:01         ` Igor Pechtchanski
2003-08-29 11:02 jurgen.defurne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).