Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Christopher Faylor
On Thu, Aug 12, 2010 at 10:35:12AM -0400, Andrew Schulman wrote:
>Let me be sure first that I understand the new functionality.  By "fail" we
>mean exiting with a non-zero status, correct?

Yes.  On Windows and on Unix a "failing" program means a program which
exits with a non-zero status.

For more details read the error reports in the Cygwin mailing list.  If
your package is failing it will be reported there.  It may not have your
package name in the subject, though, since several packages may be
showing up in the dialog box.

In theory my original message shouldn't even be needed but I'm not
seeing a lot of responses from affected package maintainers on this
issue so I wanted to make sure that it was understood that this needs to
be addressed.

cgf


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Matthias Andree
Am 12.08.2010 16:35, schrieb Andrew Schulman:
>> On Thu, Aug 12, 2010 at 09:56:49AM -0400, Andrew Schulman wrote:
>> >> Thanks to Jon Turney's recent patch we've discovered that many
>> >> post-install packages were previously failing silently. 
>> >
>> >Failing silently... so what is the preferred protocol in case a
>> >post-install script fails?  Emit a message to stderr, which will be caught
>> >and shown to the user?
>> 
>> There is apparently a disconnect here.  setup.exe now lets you know if a
>> script fails.  Scripts are not supposed to fail.  Some scripts are
>> routinely failing and should be fixed.
>> 
>> If your script fails for a valid reason then of course exiting with a
>> non-zero status is the way to go.  That is what the new dialog box was
>> intended to catch.
>> 
>> If one of your scripts does fail then you should work out why with the
>> affected user and take steps to make sure that it doesn't fail.
> 
> Let me be sure first that I understand the new functionality.  By "fail" we
> mean exiting with a non-zero status, correct?

Either that, or (hopefully) exit with a signal.

> So when a postinstall or
> preremove script exits non-zero, the user will be alerted of that fact?

There's an error popup, but I don't know which details it reports other than
pointing to setup.log.full or thereabouts.

> And maybe output to stderr and/or stdout provided, in the hope that it will
> help to diagnose the problem?
> 
> I may just be confused by your phrase "failing silently".  I'm just trying

"failing silently" means that it was logged to some file but not alerted through
the GUI, so that many users were unaware that the postinstall script had failed
somehow.

> to figure out how if at all I need to adjust my postinstall/preremove
> scripts to check for non-zero exit statuses and try to provide useful
> output about them.  Most of those scripts are short, but some contain
> multiple commands, any of which could fail for any number of reasons that
> are hard to predict.  Once a problem is well-known I can add code to check
> for it and provide a useful message, but until then, either silence or a
> possibly not very enlightening error message is going to be the usual mode
> of failure.

My primary concern is that packagers don't just write ":", "true", or "exit 0"
at the end of their postinstall scripts to mask/hide the failure.

My secondary concern is general quality of shell scripts (this is not relating
to Cygwin postinstall scripts, which I've never looked at).

Few people seem to be capable of writing solid shell scripts, because many
people often just copy & paste snippets from Google without understanding the
details.  Shell scripts are a nuisance to some, and proper training material is
hard to find on the web (there's a truckload of mediocre and incomplete stuff
though), and so I often see unquoted variable expansions (that break on blanks
in filenames already or empty variables), people treating

(a) "foo && bar" and

(b) "if foo ; then bar ; fi"

as synonymous (abusively!) to accomodate their convenience, when in fact the
exit semantics are different; "if" eats failures of its immediate condition
command, whereas "foo && " will emit the failure status.

Note that some older shell implementations (including older Almqvist and BSD
shells) got some of these semantics wrong (meaning violating POSIX).

-- 
Matthias Andree


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Andrew Schulman
> On Thu, Aug 12, 2010 at 09:56:49AM -0400, Andrew Schulman wrote:
> >> Thanks to Jon Turney's recent patch we've discovered that many
> >> post-install packages were previously failing silently. 
> >
> >Failing silently... so what is the preferred protocol in case a
> >post-install script fails?  Emit a message to stderr, which will be caught
> >and shown to the user?
> 
> There is apparently a disconnect here.  setup.exe now lets you know if a
> script fails.  Scripts are not supposed to fail.  Some scripts are
> routinely failing and should be fixed.
> 
> If your script fails for a valid reason then of course exiting with a
> non-zero status is the way to go.  That is what the new dialog box was
> intended to catch.
> 
> If one of your scripts does fail then you should work out why with the
> affected user and take steps to make sure that it doesn't fail.

Let me be sure first that I understand the new functionality.  By "fail" we
mean exiting with a non-zero status, correct?  So when a postinstall or
preremove script exits non-zero, the user will be alerted of that fact?
And maybe output to stderr and/or stdout provided, in the hope that it will
help to diagnose the problem?

I may just be confused by your phrase "failing silently".  I'm just trying
to figure out how if at all I need to adjust my postinstall/preremove
scripts to check for non-zero exit statuses and try to provide useful
output about them.  Most of those scripts are short, but some contain
multiple commands, any of which could fail for any number of reasons that
are hard to predict.  Once a problem is well-known I can add code to check
for it and provide a useful message, but until then, either silence or a
possibly not very enlightening error message is going to be the usual mode
of failure.

Anyway, I agreed that failure shouldn't happen routinely, it's good that
failures are now going to be brought to our attention, and packagers should
fix those problems when they get reported, which I guess was your main
point.

Andrew.


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Christopher Faylor
On Thu, Aug 12, 2010 at 04:19:44PM +0200, Matthias Andree wrote:
>Am 12.08.2010 01:15, schrieb Christopher Faylor:
>>Thanks to Jon Turney's recent patch we've discovered that many
>>post-install packages were previously failing silently.  Now we know
>>exactly which packages are failing because people are reporting them to
>>the cygwin list.
>>
>>These need to be fixed and I implore you to make it a priority.
>>Otherwise we're doing a disservice to our user community.
>>
>>I know we all lack tuits but I really hope that all of the affected
>>packages will take time to fix their problems.  Just look at the cygwin
>>mailing list (which you're all monitoring anyway) for errors and, if
>>your package has an error, consider rolling a -N+1 release with a fix.
>
>Oh, and please, no "add 'exit 0'" nonsense at the end of scripts, as
>I've just seen fly by on cygwin@ [1] - this will make matters worse and
>hide the now-noisy-and-formerly-silent failures more deeply in the
>system so that they're even harder to find, report, and fix.
>
>I also urgently seek those with upload privileges to refuse such
>"fixes".

Yes.  What he said.  Silently "succeeding" is not a fix for this
problem.

cgf


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Matthias Andree
Am 12.08.2010 01:15, schrieb Christopher Faylor:
> Thanks to Jon Turney's recent patch we've discovered that many
> post-install packages were previously failing silently.  Now we know
> exactly which packages are failing because people are reporting them
> to the cygwin list.
> 
> These need to be fixed and I implore you to make it a priority.
> Otherwise we're doing a disservice to our user community.
> 
> I know we all lack tuits but I really hope that all of the affected
> packages will take time to fix their problems.  Just look at the cygwin
> mailing list (which you're all monitoring anyway) for errors and, if
> your package has an error, consider rolling a -N+1 release with a fix.

Oh, and please, no "add 'exit 0'" nonsense at the end of scripts, as I've just
seen fly by on cygwin@ [1] - this will make matters worse and hide the
now-noisy-and-formerly-silent failures more deeply in the system so that they're
even harder to find, report, and fix.

I also urgently seek those with upload privileges to refuse such "fixes".

_
[1] http://www.cygwin.com/ml/cygwin/2010-08/msg00291.html and references

-- 
Matthias Andree


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Christopher Faylor
On Thu, Aug 12, 2010 at 09:56:49AM -0400, Andrew Schulman wrote:
>> Thanks to Jon Turney's recent patch we've discovered that many
>> post-install packages were previously failing silently. 
>
>Failing silently... so what is the preferred protocol in case a
>post-install script fails?  Emit a message to stderr, which will be caught
>and shown to the user?

There is apparently a disconnect here.  setup.exe now lets you know if a
script fails.  Scripts are not supposed to fail.  Some scripts are
routinely failing and should be fixed.

If your script fails for a valid reason then of course exiting with a
non-zero status is the way to go.  That is what the new dialog box was
intended to catch.

If one of your scripts does fail then you should work out why with the
affected user and take steps to make sure that it doesn't fail.

cgf


Re: NOTICE for all package maintainers with faulty post-install scripts

2010-08-12 Thread Andrew Schulman
> Thanks to Jon Turney's recent patch we've discovered that many
> post-install packages were previously failing silently. 

Failing silently... so what is the preferred protocol in case a
post-install script fails?  Emit a message to stderr, which will be caught
and shown to the user?

If a post-install script fails in an ignorable way, then does this mean
it's not acceptable to allow the script to exit with a non-zero status?
That is, we have to either exit 0, or else exit non-zero and emit a useful
message?

If a post-install script succeeds (and exits with status 0) but still emits
text to stderr or even stdout, will that text also be caught and shown to
the user?

Do the answers to all of the above also apply to preremove scripts?

Sorry if some of this has already been discussed.  I haven't followed all
of the discussion of this new feature.

Thanks,
Andrew.


NOTICE for all package maintainers with faulty post-install scripts

2010-08-11 Thread Christopher Faylor
Thanks to Jon Turney's recent patch we've discovered that many
post-install packages were previously failing silently.  Now we know
exactly which packages are failing because people are reporting them
to the cygwin list.

These need to be fixed and I implore you to make it a priority.
Otherwise we're doing a disservice to our user community.

I know we all lack tuits but I really hope that all of the affected
packages will take time to fix their problems.  Just look at the cygwin
mailing list (which you're all monitoring anyway) for errors and, if
your package has an error, consider rolling a -N+1 release with a fix.

Thanks.

cgf