From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin@cygwin.com
Subject: Re: echo -n or sleep 0 needed to unblock Bourne shell script
Date: Fri, 26 Feb 2016 13:50:00 -0000 [thread overview]
Message-ID: <56D0582D.1090608@gmail.com> (raw)
In-Reply-To: <DUB115-W730C30F47A6696F9686D308AA70@phx.gbl>
On 26/02/2016 14:04, Matthijs Nescio wrote:
> Hi,
>
> I have the strangest problem. I am running some complicated advanced Bourne shell scripting. These scripts work fine under Ubuntu 14.04 LTS. However, in Cygwin I have to add some strange commands with no obvious effect; without these the scripts just hang. I can not disclose the scripts completely because they are company property. I realise that this does not comply to the rules of smart questions, but if anybody else has this problem the Cygwinners need to know about it. I do not exactly know when these problems started. I reinstalled Cygwin twice, several weeks ago and yesterday evening.
>
> I have had this problem with several complicated, lengthy scripts. Debugging using echo debug statements is hard because the echo makes the problem go away. When I discovered similar problems in multiple scripts, I reinstalled Cygwin, but the problem persists. Also rebooting my Windows 7 Enterprise edition machine does not solve the problem. I have had some experienced colleagues to look at this and they were as flabbergasted as I was.
>
> Examples:
>
> TTP_FILE_DR_KML=`echo $TTP_FILE.dr.kml | sed -s 's#\.txt\.#\.#g'`
> #echo -n> /dev/null
> sleep 0
> if [ "`convert_needed "$TTP_FILE_DR_KML"`" = "convert" ]
> then
>
> In the examples above and below, either the sleep or the echo has to be commented in, otherwise the script just hangs. In the example below the doit function needs the echo or sleep, otherwise it does not return.
>
> doit()
> {
> # 8< code removed
> #echo -n
> sleep 0
> }
>
> In
> order to investigate this problem the Cywinners will need more information. Feel free to ask, but it may not be legal for me to share.
>
> Questions:
> * Was a similar issue ever reported? I have looked, but did not find anything.
> * Is there a solution?
>
> Thank you, kind regards, Matthijs.
I suspect you hit a corner case of resource race.
May be as the time for execution is very short :
$ time echo -n > /dev/null 0
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time sleep 0
real 0m0.070s
user 0m0.015s
sys 0m0.062s
As both the two commands are just supposed to waste minimal time,
what was the original need of both of them ?
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2016-02-26 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 13:04 Matthijs Nescio
2016-02-26 13:50 ` Marco Atzeri [this message]
2016-02-27 22:28 Matthijs Nescio
2016-02-28 7:19 ` Marco Atzeri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56D0582D.1090608@gmail.com \
--to=marco.atzeri@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).