public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
@ 2002-09-05 14:22 Max Bowsher
  2002-09-05 15:17 ` Igor Pechtchanski
  0 siblings, 1 reply; 9+ messages in thread
From: Max Bowsher @ 2002-09-05 14:22 UTC (permalink / raw)
  To: Max Bowsher, cygwin

Max Bowsher wrote:
> I've located an awkward bug in the interaction between common-sense
> Makefile rules and Cygwin libtool.
>
> The package I was building at the time was libiconv, but the issue is
> common to any autoconf-libtool build system.
>
> The libiconv.la file is installed as data (i.e. 644) - which is
> correct. However the Cygwin specific postinstall_cmds in libtool use
> the same install command to install the DLL. This results in the DLL
> being installed without execute permission (on ntsec systems), and
> causes "The application failed to initialize properly (0xc0000022)."
> errors from dependent exes.
>
> As far as I can see, the fix would be to sed '-m 644' to '-m 755' in
> Cygwin's postinstall_cmds. The problem is how (whether?) to deal with
> 600, 640, etc.

I had an idea:
sedpat6='s,\(-m [0-7]*\)6,\17,g'
sedpat4='s,\(-m [0-7]*\)4,\15,g'
sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e "$sedpat6" -e
"$sedpat6"

but can anyone show me a way without repeating each pattern 3 times?

> The same problem exists with automake in the build system (example
> package: gettext), for the same reason.

Thanks,

Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 14:22 Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific) Max Bowsher
@ 2002-09-05 15:17 ` Igor Pechtchanski
  2002-09-05 15:17   ` Max Bowsher
  0 siblings, 1 reply; 9+ messages in thread
From: Igor Pechtchanski @ 2002-09-05 15:17 UTC (permalink / raw)
  To: Max Bowsher; +Cc: cygwin

On Thu, 5 Sep 2002, Max Bowsher wrote:

> Max Bowsher wrote:
> > As far as I can see, the fix would be to sed '-m 644' to '-m 755' in
> > Cygwin's postinstall_cmds. The problem is how (whether?) to deal with
> > 600, 640, etc.
>
> I had an idea:
> sedpat6='s,\(-m [0-7]*\)6,\17,g'
> sedpat4='s,\(-m [0-7]*\)4,\15,g'
> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e "$sedpat6" -e
> "$sedpat6"
>
> but can anyone show me a way without repeating each pattern 3 times?

Hmm, "perl -pe 's/(?<=-m )([0-7]+)/($a=$1)=~tr,046,157,;$a/ge'"? O:)
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 15:17 ` Igor Pechtchanski
@ 2002-09-05 15:17   ` Max Bowsher
  2002-09-05 18:44     ` Igor Pechtchanski
  0 siblings, 1 reply; 9+ messages in thread
From: Max Bowsher @ 2002-09-05 15:17 UTC (permalink / raw)
  To: cygwin

Igor Pechtchanski wrote:
> On Thu, 5 Sep 2002, Max Bowsher wrote:
> 
>> I had an idea:
>> sedpat6='s,\(-m [0-7]*\)6,\17,g'
>> sedpat4='s,\(-m [0-7]*\)4,\15,g'
>> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e
>> "$sedpat6" -e "$sedpat6"
>> 
>> but can anyone show me a way without repeating each pattern 3 times?
> 
> Hmm, "perl -pe 's/(?<=-m )([0-7]+)/($a=$1)=~tr,046,157,;$a/ge'"? O:)

Yep, but given that this is for use in libtool, it can't rely on perl.

Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 15:17   ` Max Bowsher
@ 2002-09-05 18:44     ` Igor Pechtchanski
  2002-09-05 19:17       ` Igor Pechtchanski
  2002-09-07 10:54       ` Max Bowsher
  0 siblings, 2 replies; 9+ messages in thread
From: Igor Pechtchanski @ 2002-09-05 18:44 UTC (permalink / raw)
  To: Max Bowsher; +Cc: cygwin

On Thu, 5 Sep 2002, Max Bowsher wrote:

> Igor Pechtchanski wrote:
> > On Thu, 5 Sep 2002, Max Bowsher wrote:
> >
> >> I had an idea:
> >> sedpat6='s,\(-m [0-7]*\)6,\17,g'
> >> sedpat4='s,\(-m [0-7]*\)4,\15,g'
> >> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e
> >> "$sedpat6" -e "$sedpat6"
> >>
> >> but can anyone show me a way without repeating each pattern 3 times?
> >
> > Hmm, "perl -pe 's/(?<=-m )([0-7]+)/($a=$1)=~tr,046,157,;$a/ge'"? O:)
>
> Yep, but given that this is for use in libtool, it can't rely on perl.
> Max.

Okay, then...  There is a pure sed solution that doesn't use repetition.
It's peculiar, and involves a loop.  In this particular case, you are
probably better off just repeating the patterns 3 times.  But I'm posting
it just to show that it can be done.  Call me vain. :-D

Okay, here goes:

sed 's/$/0^A1^A2^B3^C4^E5^E6^G7^G/;:a;s/\(-m [0-7^A-^G]*\)\([0-7]\)\(.*\2\)\(.\)/\1\4\3\4/;ta;s/.\{16\}$//;y/^A^B^C^E^G/12357/'

where ^A through ^G above are actually control characters (use ^V to enter
at the prompt).  They don't have to be those exact ones, but they should
be characters that can't appear in the rest of the string (because of the
'y' command).

For those who want to decipher the code yourself, stop reading now.
Spoiler below:

The first substitution appends a fixed-length map from numbers to
associated control characters.  The second is in a loop, and basically
substitutes any number found after a "-m [0-7^A-^G]*" with the associated
character from the map, while there are characters available.  The third
substitution removes the map, and the 'y' command translates the control
characters back into digits.

I got the idea from the word capitalization script here:
http://users.cybercity.dk/~bse26236/batutil/help/sed/CAPITALI.HTM

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

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 18:44     ` Igor Pechtchanski
@ 2002-09-05 19:17       ` Igor Pechtchanski
  2002-09-07 10:54       ` Max Bowsher
  1 sibling, 0 replies; 9+ messages in thread
From: Igor Pechtchanski @ 2002-09-05 19:17 UTC (permalink / raw)
  To: cygwin; +Cc: Max Bowsher

On Thu, 5 Sep 2002, Igor Pechtchanski wrote:

> On Thu, 5 Sep 2002, Max Bowsher wrote:
> > Igor Pechtchanski wrote:
> > > On Thu, 5 Sep 2002, Max Bowsher wrote:
> > >
> > >> I had an idea:
> > >> sedpat6='s,\(-m [0-7]*\)6,\17,g'
> > >> sedpat4='s,\(-m [0-7]*\)4,\15,g'
> > >> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e
> > >> "$sedpat6" -e "$sedpat6"
> > >>
> > >> but can anyone show me a way without repeating each pattern 3 times?
> > >
> > > Hmm, "perl -pe 's/(?<=-m )([0-7]+)/($a=$1)=~tr,046,157,;$a/ge'"? O:)
> >
> > Yep, but given that this is for use in libtool, it can't rely on perl.
> > Max.
>
> Okay, then...  There is a pure sed solution that doesn't use repetition.
> It's peculiar, and involves a loop.  In this particular case, you are
> probably better off just repeating the patterns 3 times.  But I'm posting
> it just to show that it can be done.  Call me vain. :-D
>
> Okay, here goes:
>
> sed 's/$/0^A1^A2^B3^C4^E5^E6^G7^G/;:a;s/\(-m [0-7^A-^G]*\)\([0-7]\)\(.*\2\)\(.\)/\1\4\3\4/;ta;s/.\{16\}$//;y/^A^B^C^E^G/12357/'
>
> where ^A through ^G above are actually control characters (use ^V to enter
> at the prompt).  They don't have to be those exact ones, but they should
> be characters that can't appear in the rest of the string (because of the
> 'y' command).
>
> For those who want to decipher the code yourself, stop reading now.
> Spoiler below:
>
> The first substitution appends a fixed-length map from numbers to
> associated control characters.  The second is in a loop, and basically
> substitutes any number found after a "-m [0-7^A-^G]*" with the associated
> character from the map, while there are characters available.  The third
> substitution removes the map, and the 'y' command translates the control
> characters back into digits.
>
> I got the idea from the word capitalization script here:
> http://users.cybercity.dk/~bse26236/batutil/help/sed/CAPITALI.HTM
>
> Enjoy,
>         Igor

A performance improvement for this is to only execute these commands for
lines containing '-m [0-7]\+', i.e.,

sed '/-m [0-7]\+/{s/$/0^A1^A2^B3^C4^E5^E6^G7^G/;:a;s/\(-m [0-7^A-^G]*\)\([0-7]\)\(.*\2\)\(.\)/\1\4\3\4/;ta;s/.\{16\}$//;y/^A^B^C^E^G/12357/}'

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

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 18:44     ` Igor Pechtchanski
  2002-09-05 19:17       ` Igor Pechtchanski
@ 2002-09-07 10:54       ` Max Bowsher
  2002-09-08  8:49         ` Igor Pechtchanski
  1 sibling, 1 reply; 9+ messages in thread
From: Max Bowsher @ 2002-09-07 10:54 UTC (permalink / raw)
  To: cygwin

Igor Pechtchanski wrote:
>>> On Thu, 5 Sep 2002, Max Bowsher wrote:
>>>
>>>> I had an idea:
>>>> sedpat6='s,\(-m [0-7]*\)6,\17,g'
>>>> sedpat4='s,\(-m [0-7]*\)4,\15,g'
>>>> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e
>>>> "$sedpat6" -e "$sedpat6"
>>>>
>>>> but can anyone show me a way without repeating each pattern 3
>>>> times?

> Okay, then...  There is a pure sed solution that doesn't use
> repetition. It's peculiar, and involves a loop.  In this particular
> case, you are probably better off just repeating the patterns 3
> times.  But I'm posting it just to show that it can be done.  Call me
> vain. :-D
>
> Okay, here goes:
>
> sed 's/$/0^A1^A2^B3^C4^E5^E6^G7^G/;:a;s/\(-m
>
[0-7^A-^G]*\)\([0-7]\)\(.*\2\)\(.\)/\1\4\3\4/;ta;s/.\{16\}$//;y/^A^B^C^E^G/12357
/'

Thankyou :-) You clearly qualify as a sed wizard, 1st class!

However, in analysing your solution, I learnt something new about sed - namely,
the t command.
So, I can use the simpler script:

':a;s/\(-m [0-7]*\)6/\17/;s/\(-m [0-7]*\)4/\15/;ta'

Now, to build that into libtool...


Thanks for the help!

Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-07 10:54       ` Max Bowsher
@ 2002-09-08  8:49         ` Igor Pechtchanski
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Pechtchanski @ 2002-09-08  8:49 UTC (permalink / raw)
  To: Max Bowsher; +Cc: cygwin

On Sat, 7 Sep 2002, Max Bowsher wrote:

> Igor Pechtchanski wrote:
> >>> On Thu, 5 Sep 2002, Max Bowsher wrote:
> >>>
> >>>> I had an idea:
> >>>> sedpat6='s,\(-m [0-7]*\)6,\17,g'
> >>>> sedpat4='s,\(-m [0-7]*\)4,\15,g'
> >>>> sed -e "$sedpat4" -e "$sedpat4" -e "$sedpat4" -e "$sedpat6" -e
> >>>> "$sedpat6" -e "$sedpat6"
> >>>>
> >>>> but can anyone show me a way without repeating each pattern 3
> >>>> times?
>
> > Okay, then...  There is a pure sed solution that doesn't use
> > repetition. It's peculiar, and involves a loop.  In this particular
> > case, you are probably better off just repeating the patterns 3
> > times.  But I'm posting it just to show that it can be done.  Call me
> > vain. :-D
> >
> > Okay, here goes:
> >
> > sed 's/$/0^A1^A2^B3^C4^E5^E6^G7^G/;:a;s/\(-m [0-7^A-^G]*\)\([0-7]\)\(.*\2\)\(.\)/\1\4\3\4/;ta;s/.\{16\}$//;y/^A^B^C^E^G/12357/'
>
> Thankyou :-) You clearly qualify as a sed wizard, 1st class!
>
> However, in analysing your solution, I learnt something new about sed -
> namely, the t command.
> So, I can use the simpler script:
>
> ':a;s/\(-m [0-7]*\)6/\17/;s/\(-m [0-7]*\)4/\15/;ta'
>
> Now, to build that into libtool...
>
> Thanks for the help!
> Max.

D'oh! *smacks head*
I've learned something new from your solution, too: don't ever
overcomplicate :-D
I can't believe I haven't tried that one first...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
  2002-09-05 15:05 Harig, Mark A.
@ 2002-09-05 17:01 ` Max Bowsher
  0 siblings, 0 replies; 9+ messages in thread
From: Max Bowsher @ 2002-09-05 17:01 UTC (permalink / raw)
  To: Harig, Mark A., cygwin

Harig, Mark A. wrote:
>>
>> Max Bowsher wrote:
>>> I've located an awkward bug in the interaction between common-sense
>>> Makefile rules and Cygwin libtool.
>>>
>>> The package I was building at the time was libiconv, but the issue
>>> is common to any autoconf-libtool build system.
>>>
>>> The libiconv.la file is installed as data (i.e. 644) - which is
>>> correct. However the Cygwin specific postinstall_cmds in libtool use
>>> the same install command to install the DLL. This results in the DLL
>>> being installed without execute permission (on ntsec systems), and
>>> causes "The application failed to initialize properly (0xc0000022)."
>>> errors from dependent exes.
>>>
>
> Is there a reason not to create a patch that would fix the
> problem in the source of the postinstall_cmds?

The source of the postinstall_cmds is a human. Patching them can be difficult
:-).

Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific)
@ 2002-09-05 15:05 Harig, Mark A.
  2002-09-05 17:01 ` Max Bowsher
  0 siblings, 1 reply; 9+ messages in thread
From: Harig, Mark A. @ 2002-09-05 15:05 UTC (permalink / raw)
  To: Max Bowsher, cygwin



> -----Original Message-----
> From: Max Bowsher [mailto:maxb@ukf.net]
> Sent: Thursday, September 05, 2002 5:22 PM
> To: Max Bowsher; cygwin@cygwin.com
> Subject: Calling all sed wizards! Need a little help with 
> possible fix:
> Subtle permissions bug in interaction between Makefiles & libtool
> (Cygwin-specific)
> 
> 
> Max Bowsher wrote:
> > I've located an awkward bug in the interaction between common-sense
> > Makefile rules and Cygwin libtool.
> >
> > The package I was building at the time was libiconv, but 
> the issue is
> > common to any autoconf-libtool build system.
> >
> > The libiconv.la file is installed as data (i.e. 644) - which is
> > correct. However the Cygwin specific postinstall_cmds in libtool use
> > the same install command to install the DLL. This results in the DLL
> > being installed without execute permission (on ntsec systems), and
> > causes "The application failed to initialize properly (0xc0000022)."
> > errors from dependent exes.
> >

Is there a reason not to create a patch that would fix the
problem in the source of the postinstall_cmds?

---

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2002-09-08 15:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05 14:22 Calling all sed wizards! Need a little help with possible fix: Subtle permissions bug in interaction between Makefiles & libtool (Cygwin-specific) Max Bowsher
2002-09-05 15:17 ` Igor Pechtchanski
2002-09-05 15:17   ` Max Bowsher
2002-09-05 18:44     ` Igor Pechtchanski
2002-09-05 19:17       ` Igor Pechtchanski
2002-09-07 10:54       ` Max Bowsher
2002-09-08  8:49         ` Igor Pechtchanski
2002-09-05 15:05 Harig, Mark A.
2002-09-05 17:01 ` Max Bowsher

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).