Hello community, here is the log from the commit of package ghc-yaml for openSUSE:Factory checked in at 2016-10-23 12:51:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-yaml (Old) and /work/SRC/openSUSE:Factory/.ghc-yaml.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-yaml" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-yaml/ghc-yaml.changes 2016-09-05 21:19:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-yaml.new/ghc-yaml.changes 2016-10-23 12:51:06.000000000 +0200 @@ -1,0 +2,10 @@ +Mon Sep 26 06:52:12 UTC 2016 - [email protected] + +- Update to version 0.8.18.7 with cabal2obs. + +------------------------------------------------------------------- +Thu Sep 15 06:35:46 UTC 2016 - [email protected] + +- Update to version 0.8.18.6 revision 0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- yaml-0.8.18.1.tar.gz New: ---- yaml-0.8.18.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-yaml.spec ++++++ --- /var/tmp/diff_new_pack.IkIETt/_old 2016-10-23 12:51:07.000000000 +0200 +++ /var/tmp/diff_new_pack.IkIETt/_new 2016-10-23 12:51:07.000000000 +0200 @@ -19,11 +19,11 @@ %global pkg_name yaml %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.8.18.1 +Version: 0.8.18.7 Release: 0 Summary: Support for parsing and rendering YAML documents License: BSD-3-Clause -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: chrpath @@ -51,6 +51,7 @@ BuildRequires: ghc-base-compat-devel BuildRequires: ghc-hspec-devel BuildRequires: ghc-mockery-devel +BuildRequires: ghc-temporary-devel %endif %description @@ -70,20 +71,16 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install %ghc_fix_dynamic_rpath json2yaml yaml2json - %check %cabal_test - %post devel %ghc_pkg_recache ++++++ yaml-0.8.18.1.tar.gz -> yaml-0.8.18.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/ChangeLog.md new/yaml-0.8.18.7/ChangeLog.md --- old/yaml-0.8.18.1/ChangeLog.md 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/ChangeLog.md 2016-09-19 06:40:50.000000000 +0200 @@ -1,3 +1,24 @@ +## 0.8.18.7 + +* Add `O_TRUNC` when opening files + +## 0.8.18.6 + +* s/fdopen/_fdopen on Windows [#96](https://github.com/snoyberg/yaml/issues/96) + +## 0.8.18.5 + +* Properly fix previous bug (fixes #94) + +## 0.8.18.4 + +* Remove file with non-ASCII name due to Stack/cabal-install/Hackage + restrictions (see [#92](https://github.com/snoyberg/yaml/issues/92)) + +## 0.8.18.2 + +* Handle non-ASCII filenames correctly on Windows [#91](https://github.com/snoyberg/yaml/pull/91) + ## 0.8.18.1 * Improve prettyPrintParseException when context is empty [#89](https://github.com/snoyberg/yaml/pull/89) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/Text/Libyaml.hs new/yaml-0.8.18.7/Text/Libyaml.hs --- old/yaml-0.8.18.1/Text/Libyaml.hs 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/Text/Libyaml.hs 2016-09-19 06:40:50.000000000 +0200 @@ -29,6 +29,7 @@ import Prelude hiding (pi) +import Data.Bits ((.|.)) import Foreign.C import Foreign.Ptr import Foreign.ForeignPtr @@ -36,6 +37,7 @@ import Foreign.ForeignPtr.Unsafe #endif import Foreign.Marshal.Alloc +import qualified System.Posix.Internals as Posix #if !MIN_VERSION_base(4,8,0) import Control.Applicative @@ -147,11 +149,14 @@ data FileStruct type File = Ptr FileStruct -foreign import ccall unsafe "fopen" - c_fopen :: Ptr CChar - -> Ptr CChar - -> IO File - +#ifdef WINDOWS +foreign import ccall unsafe "_fdopen" +#else +foreign import ccall unsafe "fdopen" +#endif + c_fdopen :: CInt + -> Ptr CChar + -> IO File foreign import ccall unsafe "fclose" c_fclose :: File -> IO () @@ -503,6 +508,24 @@ c_yaml_parser_delete ptr free ptr +-- XXX copied from GHC.IO.FD +std_flags, read_flags, output_flags, write_flags :: CInt +std_flags = Posix.o_NOCTTY +output_flags = std_flags .|. Posix.o_CREAT .|. Posix.o_TRUNC +read_flags = std_flags .|. Posix.o_RDONLY +write_flags = output_flags .|. Posix.o_WRONLY + +-- | Open a C FILE* from a file path, using internal GHC API to work correctly +-- on all platforms, even on non-ASCII filenames. The opening mode must be +-- indicated via both 'rawOpenFlags' and 'openMode'. +openFile :: FilePath -> CInt -> String -> IO File +openFile file rawOpenFlags openMode = do + fd <- liftIO $ Posix.withFilePath file $ \file' -> + Posix.c_open file' rawOpenFlags 0o666 + if fd /= (-1) + then withCString openMode $ \openMode' -> c_fdopen fd openMode' + else return nullPtr + decodeFile :: MonadResource m => FilePath #if MIN_VERSION_conduit(1, 0, 0) -> Producer m Event @@ -521,12 +544,9 @@ free ptr throwIO $ YamlException "Yaml out of memory" else do - file' <- liftIO - $ withCString file $ \file' -> withCString "r" $ \r' -> - c_fopen file' r' + file' <- openFile file read_flags "r" if file' == nullPtr then do - c_fclose_helper file' c_yaml_parser_delete ptr free ptr throwIO $ YamlException @@ -599,9 +619,7 @@ bracketP getFile c_fclose $ \file -> runEmitter (alloc file) (\u _ -> return u) where getFile = do - file <- withCString filePath $ - \filePath' -> withCString "w" $ - \w' -> c_fopen filePath' w' + file <- openFile filePath write_flags "w" if file == nullPtr then throwIO $ YamlException $ "could not open file for write: " ++ filePath else return file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/c/helper.c new/yaml-0.8.18.7/c/helper.c --- old/yaml-0.8.18.1/c/helper.c 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/c/helper.c 2016-09-19 06:40:50.000000000 +0200 @@ -13,10 +13,10 @@ { buffer_t *b = ext; int new_size, new_used; - char *tmp; + unsigned char *tmp; new_used = b->used + size; - for (new_size = b->size || 8; new_size < new_used; new_size *= 2); + for (new_size = b->size ? b->size : 8; new_size < new_used; new_size *= 2); if (new_size != b->size) { tmp = realloc(b->buff, new_size); @@ -46,12 +46,12 @@ yaml_emitter_set_output(e, buffer_append, b); } -unsigned char const * get_parser_error_problem(yaml_parser_t *p) +char const * get_parser_error_problem(yaml_parser_t *p) { return p->problem; } -unsigned char const * get_parser_error_context(yaml_parser_t *p) +char const * get_parser_error_context(yaml_parser_t *p) { return p->context; } @@ -71,7 +71,7 @@ return p->problem_mark.column; } -unsigned char const * get_emitter_error(yaml_emitter_t *e) +char const * get_emitter_error(yaml_emitter_t *e) { return e->problem; } @@ -104,13 +104,13 @@ unsigned char * get_scalar_tag(yaml_event_t *e) { unsigned char *s = e->data.scalar.tag; - if (!s) s = ""; + if (!s) s = (unsigned char *) ""; return s; } unsigned long get_scalar_tag_len(yaml_event_t *e) { - return strlen(get_scalar_tag(e)); + return strlen((char *) get_scalar_tag(e)); } int get_scalar_style(yaml_event_t *e) @@ -143,6 +143,7 @@ FILE *in = fopen(filename, "r"); if (!in) return 0; yaml_parser_set_input_file(parser, in); + return 1; } int fclose_helper(FILE *file) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/c/helper.h new/yaml-0.8.18.7/c/helper.h --- old/yaml-0.8.18.1/c/helper.h 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/c/helper.h 2016-09-19 06:40:50.000000000 +0200 @@ -14,11 +14,11 @@ void my_emitter_set_output(yaml_emitter_t *e, buffer_t *b); -unsigned char const * get_parser_error_problem(yaml_parser_t *p); -unsigned char const * get_parser_error_context(yaml_parser_t *p); +char const * get_parser_error_problem(yaml_parser_t *p); +char const * get_parser_error_context(yaml_parser_t *p); unsigned int get_parser_error_offset(yaml_parser_t *p); -unsigned char const * get_emitter_error(yaml_emitter_t *e); +char const * get_emitter_error(yaml_emitter_t *e); int simple_document_start(yaml_event_t *e); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/examples/Config.hs new/yaml-0.8.18.7/examples/Config.hs --- old/yaml-0.8.18.1/examples/Config.hs 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/examples/Config.hs 2016-09-19 06:40:50.000000000 +0200 @@ -9,6 +9,7 @@ import Text.RawString.QQ import Data.ByteString (ByteString) import Control.Applicative +import Prelude -- Ensure Applicative is in scope and we have no warnings, before/after AMP. configYaml :: ByteString configYaml = [r| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/test/Data/YamlSpec.hs new/yaml-0.8.18.7/test/Data/YamlSpec.hs --- old/yaml-0.8.18.1/test/Data/YamlSpec.hs 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/test/Data/YamlSpec.hs 2016-09-19 06:40:50.000000000 +0200 @@ -19,6 +19,7 @@ import Control.Exception (try, SomeException) import Test.Hspec import Data.Either.Compat +import System.Directory (createDirectory, createDirectoryIfMissing) import Test.Mockery.Directory import qualified Data.Yaml as D @@ -33,6 +34,8 @@ import qualified Data.Vector as V import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HM +import System.IO (hClose) +import System.IO.Temp (withSystemTempFile) data TestJSON = TestJSON { string :: Text @@ -63,6 +66,7 @@ describe "Data.Yaml" $ do it "encode/decode" caseEncodeDecodeData it "encode/decode file" caseEncodeDecodeFileData + it "encode/decode files with non-ASCII names" caseEncodeDecodeNonAsciiFileData it "encode/decode strings" caseEncodeDecodeStrings it "decode invalid file" caseDecodeInvalid it "processes datatypes" caseDataTypes @@ -150,6 +154,8 @@ it "preserves Scientific precision" casePreservesScientificPrecision + it "truncates files" caseTruncatesFiles + specialStrings :: [T.Text] specialStrings = @@ -317,6 +323,22 @@ out <- D.decodeFile fp out @?= Just sample +caseEncodeDecodeNonAsciiFileData :: Assertion +caseEncodeDecodeNonAsciiFileData = do + let mySample = (object ["foo" .= True]) + inTempDirectory $ do + createDirectory "accenté" + D.encodeFile "accenté/bar.yaml" mySample + out1 <- D.decodeFile "accenté/bar.yaml" + out1 @?= Just mySample + + createDirectoryIfMissing True "test/resources/accenté/" + + readFile "test/resources/accent/foo.yaml" >>= + writeFile "test/resources/accenté/foo.yaml" + out2 <- D.decodeFile "test/resources/accenté/foo.yaml" + out2 @?= Just mySample + caseEncodeDecodeStrings :: Assertion caseEncodeDecodeStrings = do let out = D.decode $ D.encode sample @@ -484,3 +506,12 @@ -- results, because of <https://github.com/bos/text/issues/34>. D.decodeEither "x: 9.78159610558926e-5" @?= Right (object [ "x" .= D.Number (read "9.78159610558926e-5") ]) + +caseTruncatesFiles :: Assertion +caseTruncatesFiles = withSystemTempFile "truncate.yaml" $ \fp h -> do + replicateM_ 500 $ B8.hPut h "HELLO WORLD!!!!!\n" + hClose h + let val = object ["hello" .= ("world" :: String)] + D.encodeFile fp val + res <- D.decodeFileEither fp + either (Left . show) Right res `shouldBe` Right val diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/test/resources/accent/foo.yaml new/yaml-0.8.18.7/test/resources/accent/foo.yaml --- old/yaml-0.8.18.1/test/resources/accent/foo.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/yaml-0.8.18.7/test/resources/accent/foo.yaml 2016-09-19 06:40:50.000000000 +0200 @@ -0,0 +1 @@ +foo: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.18.1/yaml.cabal new/yaml-0.8.18.7/yaml.cabal --- old/yaml-0.8.18.1/yaml.cabal 2016-07-19 17:43:07.000000000 +0200 +++ new/yaml-0.8.18.7/yaml.cabal 2016-09-19 06:40:50.000000000 +0200 @@ -1,8 +1,8 @@ name: yaml -version: 0.8.18.1 +version: 0.8.18.7 license: BSD3 license-file: LICENSE -author: Michael Snoyman <[email protected]>, Anton Ageev <[email protected]>,Kirill Simonov +author: Michael Snoyman <[email protected]>, Anton Ageev <[email protected]>,Kirill Simonov maintainer: Michael Snoyman <[email protected]> synopsis: Support for parsing and rendering YAML documents. description: Please see the README.md file. @@ -20,6 +20,7 @@ test/resources/foo.yaml test/resources/bar.yaml test/resources/baz.yaml + test/resources/accent/foo.yaml test/resources/loop/foo.yaml test/resources/loop/bar.yaml README.md @@ -85,6 +86,8 @@ libyaml/scanner.c, libyaml/writer.c include-dirs: libyaml + if os(windows) + cpp-options: -DWINDOWS executable yaml2json if flag(no-exe) @@ -130,11 +133,13 @@ , text , aeson >= 0.7 , unordered-containers + , directory , vector , resourcet , aeson-qq , mockery , base-compat + , temporary ghc-options: -Wall executable examples
