Here is a strange patch (recorded for darcs-stable, but with a
resolution for unstable) that should probably not be applied to
any public repo yet, until it's first tested by those
experiencing the problems listed in the long comment.

It ignores the error from hSetBuffering and simply continues as
if there were no error. I have not detected any (new) ill
behaviors from this on my system, but that doesn't prove
anything.

One (still present) disturbing thing is that the darcs
invocation as a whole sometimes eats up one char typed ahead on
the terminal even when it's not supposed to ask for any input.

A more disturbing thing is I don't have a clue what the real
problem is, e.g., why hSetBuffering fails in the first place.

But if this patch makes things work without problems, why not
just apply it and be ignorant and merry? ;-) Until something
else changes and this _really_ breaks... Well, I'm receptive for
better ideas, comments and suggestions.



Fri Nov 17 23:14:24 CET 2006  Tommy Pettersson <[EMAIL PROTECTED]>
  * ignore failure from hSetBuffering
  This affects:
    issue41     Doesn't like pasted text.
    issue94     Crash on bogus input
    issue146    hSetBuffering: invalid argument
    issue318    buffering error of darcs record under bash/cmd.exe
  It doesn't necessarily "fix" anything. It prevents darcs from quiting,
  instead continuing with perhaps an undesirable buffering mode, which may or
  may not be better ... or worse.

Fri Nov 17 23:27:57 CET 2006  Tommy Pettersson <[EMAIL PROTECTED]>
  * resolve conflicts
  between 'clean up unrevert and pending handling'
  and 'ignore failure from hSetBufferin'
New patches:

[ignore failure from hSetBuffering
Tommy Pettersson <[EMAIL PROTECTED]>**20061117221424
 This affects:
   issue41	Doesn't like pasted text.
   issue94	Crash on bogus input
   issue146	hSetBuffering: invalid argument
   issue318	buffering error of darcs record under bash/cmd.exe
 It doesn't necessarily "fix" anything. It prevents darcs from quiting,
 instead continuing with perhaps an undesirable buffering mode, which may or
 may not be better ... or worse.
] 
<
> {
merger 0.0 (
hunk ./SelectChanges.lhs 243
-
-without_buffering :: IO a -> IO a
-without_buffering job = do
-    bracket nobuf rebuf $ \_ -> job
-    where nobuf = do is_term <- hIsTerminalDevice stdin
-                     bi <- hGetBuffering stdin
-                     raw <- get_raw_mode
-                     when is_term $ do hSetBuffering stdin NoBuffering
-                                       set_raw_mode True
-                     return (bi,raw)
-          rebuf (bi,raw) = do is_term <- hIsTerminalDevice stdin
-#if SYS == windows
-                              buffers <- hGetBuffering stdin
-                              hSetBuffering stdin NoBuffering `catch` \_ -> return ()
-                              drop_returns
-                              hSetBuffering stdin buffers `catch` \_ -> return ()
-#else
-                              drop_returns
-#endif
-                              when is_term $ do hSetBuffering stdin bi
-                                                set_raw_mode raw
-          drop_returns = do is_ready <- hReady stdin
-                            when is_ready $
-                              do c <- hLookAhead stdin `catch` \_ -> return ' '
-                                 when (c == '\n') $
-                                   do getChar
-                                      drop_returns
-
hunk ./SelectChanges.lhs 250
-                     when is_term $ do hSetBuffering stdin NoBuffering
+                     when is_term $ do hSetBuffering stdin NoBuffering `catch` \_ -> return ()
)
merger 0.0 (
merger 0.0 (
hunk ./SelectChanges.lhs 250
-                     when is_term $ do hSetBuffering stdin NoBuffering
+                     when is_term $ do hSetBuffering stdin NoBuffering `catch` \_ -> return ()
hunk ./SelectChanges.lhs 243
-
-without_buffering :: IO a -> IO a
-without_buffering job = do
-    bracket nobuf rebuf $ \_ -> job
-    where nobuf = do is_term <- hIsTerminalDevice stdin
-                     bi <- hGetBuffering stdin
-                     raw <- get_raw_mode
-                     when is_term $ do hSetBuffering stdin NoBuffering
-                                       set_raw_mode True
-                     return (bi,raw)
-          rebuf (bi,raw) = do is_term <- hIsTerminalDevice stdin
-#if SYS == windows
-                              buffers <- hGetBuffering stdin
-                              hSetBuffering stdin NoBuffering `catch` \_ -> return ()
-                              drop_returns
-                              hSetBuffering stdin buffers `catch` \_ -> return ()
-#else
-                              drop_returns
-#endif
-                              when is_term $ do hSetBuffering stdin bi
-                                                set_raw_mode raw
-          drop_returns = do is_ready <- hReady stdin
-                            when is_ready $
-                              do c <- hLookAhead stdin `catch` \_ -> return ' '
-                                 when (c == '\n') $
-                                   do getChar
-                                      drop_returns
-
)
hunk ./SelectChanges.lhs 262
-                              when is_term $ do hSetBuffering stdin bi
+                              when is_term $ do hSetBuffering stdin bi `catch` \_ -> return ()
)
}
[resolve conflicts
Tommy Pettersson <[EMAIL PROTECTED]>**20061117222757
 between 'clean up unrevert and pending handling'
 and 'ignore failure from hSetBufferin'
] 
<
> {
hunk ./DarcsUtils.lhs 193
     where nobuf = do is_term <- hIsTerminalDevice stdin
                      bi <- hGetBuffering stdin
                      raw <- get_raw_mode
-                     when is_term $ do hSetBuffering stdin NoBuffering
+                     when is_term $ do hSetBuffering stdin NoBuffering `catch` \_ -> return ()
                                        set_raw_mode True
                      return (bi,raw)
           rebuf (bi,raw) = do is_term <- hIsTerminalDevice stdin
hunk ./DarcsUtils.lhs 205
 #else
                               drop_returns
 #endif
-                              when is_term $ do hSetBuffering stdin bi
+                              when is_term $ do hSetBuffering stdin bi `catch` \_ -> return ()
                                                 set_raw_mode raw
           drop_returns = do is_ready <- hReady stdin
                             when is_ready $
hunk ./SelectChanges.lhs 242
             Nothing -> impossible
         Nothing -> do putStrLn $ "Cancelling "++jn++" since no patch was selected."
                       exitWith $ ExitSuccess
-
-
-without_buffering :: IO a -> IO a
-without_buffering job = do
-    bracket nobuf rebuf $ \_ -> job
-    where nobuf = do is_term <- hIsTerminalDevice stdin
-                     bi <- hGetBuffering stdin
-                     raw <- get_raw_mode
-                     when is_term $ do hSetBuffering stdin NoBuffering
-                                       set_raw_mode True
-                     return (bi,raw)
-          rebuf (bi,raw) = do is_term <- hIsTerminalDevice stdin
-#if SYS == windows
-                              buffers <- hGetBuffering stdin
-                              hSetBuffering stdin NoBuffering `catch` \_ -> return ()
-                              drop_returns
-                              hSetBuffering stdin buffers `catch` \_ -> return ()
-#else
-                              drop_returns
-#endif
-                              when is_term $ do hSetBuffering stdin bi
-                                                set_raw_mode raw
-          drop_returns = do is_ready <- hReady stdin
-                            when is_ready $
-                              do c <- hLookAhead stdin `catch` \_ -> return ' '
-                                 when (c == '\n') $
-                                   do getChar
-                                      drop_returns
 
 wspfr :: String -> ((PatchInfo, Maybe Patch) -> Bool)
       -> [(PatchInfo, Maybe Patch)] -> [Patch]
}

Context:

[refactor is_malicious_path (for easier reading)
Tommy Pettersson <[EMAIL PROTECTED]>**20061113191040] 
[really use new malicious file path check in pull (not in changes)
Tommy Pettersson <[EMAIL PROTECTED]>**20061113182628] 
[remove old malicious_filename check (issue177)
Tommy Pettersson <[EMAIL PROTECTED]>**20061110211757] 
[Update FSF address in DarcsCommandsAux.lhs.
Eric Kow <[EMAIL PROTECTED]>**20061113032907] 
[use new malicious file path check in pull and apply (issue177)
Tommy Pettersson <[EMAIL PROTECTED]>**20061110211702] 
[fix latex markup error
Tommy Pettersson <[EMAIL PROTECTED]>**20061110205511] 
[add new malicious file path check system
Tommy Pettersson <[EMAIL PROTECTED]>**20061110132338
 Adds a new module DarcsCommandsAux for auxiliary functionality common to
 more than one darcs command.
] 
[add function for finding all file names in a patch
Tommy Pettersson <[EMAIL PROTECTED]>**20061109144144] 
[Resolve conflict in Resolution.lhs.
Eric Kow <[EMAIL PROTECTED]>**20061113032236
 
] 
[External resolution can resolve conflicting adds
[EMAIL PROTECTED] 
[Only copy files needed in external_resolution
[EMAIL PROTECTED] 
[Extra boring patterns.
Dave Love <[EMAIL PROTECTED]>**20061109004620] 
[really dump generated darcs.ps in subdir manual/
Tommy Pettersson <[EMAIL PROTECTED]>**20061108175122
 Now with working makefile!
] 
[update annotate for hashed inventories
Jason Dagit <[EMAIL PROTECTED]>**20061108033202
 Fixes test suite failure for annotate on a repository with hashed inventory.
] 
[make darcs.cgi look for both pristine and current
Dan <[EMAIL PROTECTED]>**20061101222005] 
[change message in 'darcs check' from "applying" to "checking" (issue147)
Tommy Pettersson <[EMAIL PROTECTED]>**20061111154259] 
[add missing space in print_version (issue283)
Tommy Pettersson <[EMAIL PROTECTED]>**20061111132808] 
[Update FSF address in copyright headers.
Dave Love <[EMAIL PROTECTED]>**20061104180508] 
[Add COPYING.LIB for fpstring.c.
Dave Love <[EMAIL PROTECTED]>**20061104180121] 
[Add a semi-automated test for SSH-related things.
Eric Kow <[EMAIL PROTECTED]>**20061110110801
 
 Testing SSH stuff is tricky in that (1) you need some place to connect
 to and (2) you often want to make sure that the user interactions work
 out right.  But it can't hurt to script away the boring stuff so that
 you are naturally encouraged to test things out more thoroughly.
] 
[Pass -q flag to scp only, not ssh and scp.
Eric Kow <[EMAIL PROTECTED]>**20061108225137
 
 Putty's SSH (plink) does not recognise the -q flag.
 
] 
[Don't lock the repo during `query manifest' (issue315).
Dave Love <[EMAIL PROTECTED]>**20061105125701] 
[Include curses.h with term.h (issue326).
Dave Love <[EMAIL PROTECTED]>**20061105123851] 
[dump generated darcs.ps in subdir manual/
Tommy Pettersson <[EMAIL PROTECTED]>**20061102152516] 
[resolve conflicts
Tommy Pettersson <[EMAIL PROTECTED]>**20061102184834
 Merge Unrecord fix for checkpoints inventory with Repository code refactoring.
] 
[remove unrecorded tags from the checkpoint inventory (issue281)
Tommy Pettersson <[EMAIL PROTECTED]>**20061031220157
 The commands Check, Get and Repair all can make use of the checkpoint
 inventory. Unrecord, Unpull and Obliterate forgot to remove deleted patches
 from that inventory.
] 
[add test that unrecord of tag removes checkpoint
Tommy Pettersson <[EMAIL PROTECTED]>**20061007152648] 
[add HACKING file
Jason Dagit <[EMAIL PROTECTED]>**20061104214749] 
[English and markup fixes.
Dave Love <[EMAIL PROTECTED]>**20061104153036] 
[I fixed up a bit of bad grammars.
Bill Trost <[EMAIL PROTECTED]>**20061102033207] 
[bumb version to 1.0.9rc2
Tommy Pettersson <[EMAIL PROTECTED]>**20061009204226] 
[make Get work with hashed inventory.
David Roundy <[EMAIL PROTECTED]>**20061101150901
 This is inefficient, but it uses only the pre-existing refactored
 functions, so it's the easiest approach.  Later we can write an efficient
 bit of code to do the same thing.
] 
[make darcs check use Repository framework.
David Roundy <[EMAIL PROTECTED]>**20060927024514] 
[fix parsing of hashed inventories.
David Roundy <[EMAIL PROTECTED]>**20060927024505] 
[put Repository in Show class for debugging ease.
David Roundy <[EMAIL PROTECTED]>**20060927021202] 
[add test target for testing hashed inventories.
David Roundy <[EMAIL PROTECTED]>**20060927020127] 
[add a bit of hashed inventory code.
David Roundy <[EMAIL PROTECTED]>**20060918173904] 
[Do _not_ allow escaped quotes in `quoted'.
Eric Kow <[EMAIL PROTECTED]>**20061030064531
 
 This undoes the patch by Dave Love: Allow escaped quotes in `quoted'.
 The immediate problem is that it breaks make_changelog (because one of
 Tommy's entries matches on a backslash).  This feature might need more
 discussion before we include it (or not).
 
] 
[Tidy filenames before invoking tar 
Wim Lewis <[EMAIL PROTECTED]>**20061026035535
 Only use the last path component of --dist-name for the distribution
 name; the rest is still used when creating the final tar file. (issue323)
] 
[Pass email address only for %t in --sendmail-command.
Eric Kow <[EMAIL PROTECTED]>**20061029112604
 
 Given an address like Bubba Dupont <[EMAIL PROTECTED]>, pass
 [EMAIL PROTECTED] to the %t argument.  Msmtp seems to require this
 at least.  Note that the full address (Bubba Dupont etc) is already
 encoded in the message body anyway.
 
] 
[Refactor sendEmail and sendEmailDoc.
Eric Kow <[EMAIL PROTECTED]>**20061029105048] 
[Make Send code slightly easier to understand.
Eric Kow <[EMAIL PROTECTED]>**20061029100316] 
[Add hi-boot and o-boot extensions in default boring file.
Eric Kow <[EMAIL PROTECTED]>**20061019071304
 
 These are automatically generated from hs-boot.
 Suggested by Bulat Ziganshin.
 
] 
[Replace tabs with spaces (escaped quotes in PatchMatch).
Eric Kow <[EMAIL PROTECTED]>**20061023192003] 
[Fix some obsolete autoconf stuff.
Dave Love <[EMAIL PROTECTED]>**20061015155914] 
[Allow escaped quotes in `quoted'.
Dave Love <[EMAIL PROTECTED]>**20060716193940] 
[Added --store-in-memory option for diff
[EMAIL PROTECTED]
 
] 
[Require 'permission denied' test for MacOS X again.
Eric Kow <[EMAIL PROTECTED]>**20060930121032
 
 This removes a workaround that had demoted a pull.pl test to a mere TODO under
 MacOS X. For some reason, under MacOS X, we would occasionally get "Unexpected
 error: 0" instead of "permission denied".  The error was first reported on
 2005-11-06 by Erik Schnetter.  We still don't know why it does this, but now
 test seems to systematically "unexpectedly succeed" under MacOS X 10.4.7.
 Perhaps something in MacOS X that was fixed since the error was reported?
 
] 
[Added rigorous error checking in exec
Magnus Jonsson <[EMAIL PROTECTED]>**20061006222630
 All lowlevel C return values are checked and turned into
 exceptions if they are error codes. In darcs main
 ExecExceptions are caught and turned into error messages
 to help the user.
] 
[Look for Text.Regex in package regex-compat. Needed for GHC 6.6
Josef Svenningsson <[EMAIL PROTECTED]>**20061004123158] 
[Move RawMode into DarcsUtils to break cyclic imports on Win32
Josef Svenningsson <[EMAIL PROTECTED]>**20061004120024] 
[remove duplicate file names in fix_filepaths (fixes issue273)
Tommy Pettersson <[EMAIL PROTECTED]>**20060929145335] 
[add test for replace command with duplicated file name
Tommy Pettersson <[EMAIL PROTECTED]>**20060929144008] 
[Move bug reporting code to its own module.
Eric Kow <[EMAIL PROTECTED]>**20060928222826
 
 Fixes circular dependency caused by David's unrevert cleanup (which moves
 edit_file to DarcsUtil, thus causing it to depend on Exec) and Tommy's
 exec patches (which add impossible.h to Exec, thus causing it to depend
 on DarcsUtil).
 
] 
[clean up unrevert and pending handling.
David Roundy <[EMAIL PROTECTED]>**20060917214136] 
[show error messages when starting and stoping the ssh control master
Tommy Pettersson <[EMAIL PROTECTED]>**20060916010645] 
[redirect errors to stderr where exec output is used
Tommy Pettersson <[EMAIL PROTECTED]>**20060916005651
 Error messages would destroy the result if they ended up in the output.
 If the external command fails, darcs should (but does not always) fail.
] 
[Fix merge conflicts.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20060906191317] 
[fix bug in pristine handling when dealing with multiple patches.
David Roundy <[EMAIL PROTECTED]>**20060731111404] 
[fix ordering of operations to call pull_first_middles properly.
David Roundy <[EMAIL PROTECTED]>**20060730111409] 
[fix bug in refactoring of get.
David Roundy <[EMAIL PROTECTED]>**20060726121655] 
[refactor Population.
David Roundy <[EMAIL PROTECTED]>**20060716034837] 
[add TODO for refactoring get_markedup_file.
David Roundy <[EMAIL PROTECTED]>**20060716034339] 
[partial refactoring in annotate.
David Roundy <[EMAIL PROTECTED]>**20060716034319] 
[don't use DarcsRepo in list_authors.
David Roundy <[EMAIL PROTECTED]>**20060716033450] 
[I've now eliminated need to export DarcsRepo.write_patch.
David Roundy <[EMAIL PROTECTED]>**20060716033109] 
[partially refactor Optimize.
David Roundy <[EMAIL PROTECTED]>**20060716032934] 
[partial refactoring of Get.
David Roundy <[EMAIL PROTECTED]>**20060716031605] 
[refactor amend-record.
David Roundy <[EMAIL PROTECTED]>**20060716021003] 
[add TODO to refactor unrevert handling.
David Roundy <[EMAIL PROTECTED]>**20060716020247] 
[refactor Unrecord, adding tentativelyRemovePatches.
David Roundy <[EMAIL PROTECTED]>**20060716015150] 
[refactor tag.
David Roundy <[EMAIL PROTECTED]>**20060716011853] 
[refactor Repository to allow truly atomic updates.
David Roundy <[EMAIL PROTECTED]>**20060716011245] 
[Be explicit about timezone handling (issue220); assume local by default.
Eric Kow <[EMAIL PROTECTED]>**20060812102034
 
 Except for the local timezone in the user interface, this patch is not
 expected to change darcs's behaviour.  It merely makes current practice
 explicit:
 
 - Assume local timezone when parsing date strings from the user
   interface (previous behaviour was assuming UTC).
 
 - Assume UTC timezone when parsing date strings from PatchInfo.
   Newer patch date strings do *not* specify the timezone, so it
   would be prudent to treat these as UTC.
  
 - Disregard timezone information altogether when reading patch
   dates (issue220).  Note that this bug was not caused by assuming local
   timezone, because legacy patch date strings explicitly tell you what
   the timezone to use.  The bug was caused by a patch that fixed
   issue173 by using timezone information correctly.  To preserve
   backwards-compatability, we deliberatly replicate the incorrect
   behaviour of overriding the timezone with UTC.
   (PatchInfo.make_filename)
  
] 
[Account for timezone offset in cleanDate  (Fixes issue173).
Eric Kow <[EMAIL PROTECTED]>**20060610193049
 
] 
[TAG darcs-unstable-20060831
Juliusz Chroboczek <[EMAIL PROTECTED]>**20060831191554] 
[Test pull.pl, CREATE_DIR_ERROR: removed TODO now that directory name is printed in error message
Marnix Klooster <[EMAIL PROTECTED]>**20060304164033
 Also removes a superfluous (and erroneous) chdir statement, which tried to
 change to non-existing directory templ (last character was ell instead of one).
 
 Also improves the description of this test.
] 
[TAG 1.0.9rc1
Tommy Pettersson <[EMAIL PROTECTED]>**20061008175207] 
Patch bundle hash:
fe35a21af9e0850e62c62fd324b2a334a4bd0ae2
_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to