Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-hslua-module-path for 
openSUSE:Factory checked in at 2022-10-13 15:42:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hslua-module-path (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-hslua-module-path.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-hslua-module-path"

Thu Oct 13 15:42:10 2022 rev:5 rq:1008473 version:1.0.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-hslua-module-path/ghc-hslua-module-path.changes  
    2022-08-01 21:28:52.721394773 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-hslua-module-path.new.2275/ghc-hslua-module-path.changes
    2022-10-13 15:42:15.798751759 +0200
@@ -1,0 +2,13 @@
+Fri Aug 19 11:09:37 UTC 2022 - Peter Simons <[email protected]>
+
+- Update hslua-module-path to version 1.0.3.
+  ## hslua-module-path-1.0.3
+
+  Released 2022-08-19.
+
+  -   Fixed `make_relative` for longer base paths: Ensure that the
+      function produces correct results in cases where the root
+      (base) path has more components than the path that should be
+      made relative.
+
+-------------------------------------------------------------------

Old:
----
  hslua-module-path-1.0.2.tar.gz

New:
----
  hslua-module-path-1.0.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-hslua-module-path.spec ++++++
--- /var/tmp/diff_new_pack.y8LKL3/_old  2022-10-13 15:42:16.786753688 +0200
+++ /var/tmp/diff_new_pack.y8LKL3/_new  2022-10-13 15:42:16.794753703 +0200
@@ -19,7 +19,7 @@
 %global pkg_name hslua-module-path
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.0.2
+Version:        1.0.3
 Release:        0
 Summary:        Lua module to work with file paths
 License:        MIT

++++++ hslua-module-path-1.0.2.tar.gz -> hslua-module-path-1.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-path-1.0.2/CHANGELOG.md 
new/hslua-module-path-1.0.3/CHANGELOG.md
--- old/hslua-module-path-1.0.2/CHANGELOG.md    2001-09-09 03:46:40.000000000 
+0200
+++ new/hslua-module-path-1.0.3/CHANGELOG.md    2001-09-09 03:46:40.000000000 
+0200
@@ -2,6 +2,15 @@
 
 `hslua-module-paths` uses [PVP Versioning][].
 
+## hslua-module-path-1.0.3
+
+Released 2022-08-19.
+
+-   Fixed `make_relative` for longer base paths: Ensure that the
+    function produces correct results in cases where the root
+    (base) path has more components than the path that should be
+    made relative.
+
 ## hslua-module-path-1.0.2
 
 Released 2022-02-19.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-path-1.0.2/hslua-module-path.cabal 
new/hslua-module-path-1.0.3/hslua-module-path.cabal
--- old/hslua-module-path-1.0.2/hslua-module-path.cabal 2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-path-1.0.3/hslua-module-path.cabal 2001-09-09 
03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 name:                hslua-module-path
-version:             1.0.2
+version:             1.0.3
 synopsis:            Lua module to work with file paths.
 description:         Lua module to work with file paths in a platform
                      independent way.
@@ -22,8 +22,8 @@
                    , GHC == 8.6.5
                    , GHC == 8.8.4
                    , GHC == 8.10.7
-                   , GHC == 9.0.1
-                   , GHC == 9.2.1
+                   , GHC == 9.0.2
+                   , GHC == 9.2.3
 
 source-repository head
   type:                git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-path-1.0.2/src/HsLua/Module/Path.hs 
new/hslua-module-path-1.0.3/src/HsLua/Module/Path.hs
--- old/hslua-module-path-1.0.2/src/HsLua/Module/Path.hs        2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-path-1.0.3/src/HsLua/Module/Path.hs        2001-09-09 
03:46:40.000000000 +0200
@@ -1,5 +1,4 @@
 {-# LANGUAGE CPP #-}
-{-# LANGUAGE LambdaCase #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-|
 Module      : HsLua.Module.Path
@@ -34,7 +33,6 @@
   )
 where
 
-import Data.Char (toLower)
 #if !MIN_VERSION_base(4,11,0)
 import Data.Semigroup (Semigroup(..))  -- includes (<>)
 #endif
@@ -338,40 +336,17 @@
              -> FilePath      -- ^ root directory from which to start
              -> Maybe Bool    -- ^ whether to use unsafe relative paths.
              -> FilePath
-makeRelative path root unsafe
+makeRelative path root (Just True)
  | Path.equalFilePath root path = "."
- | takeAbs root /= takeAbs path = path
- | otherwise = go (dropAbs path) (dropAbs root)
-  where
-    go x "" = dropWhile Path.isPathSeparator x
-    go x y =
-      let (x1, x2) = breakPath x
-          (y1, y2) = breakPath y
-      in case () of
-        _ | Path.equalFilePath x1 y1 -> go x2 y2
-        _ | unsafe == Just True      -> Path.joinPath ["..", x1, go x2 y2]
-        _                            -> path
-
-    breakPath = both (dropWhile Path.isPathSeparator)
-              . break Path.isPathSeparator
-              . dropWhile Path.isPathSeparator
-
-    both f (a, b) = (f a, f b)
-
-    leadingPathSepOnWindows = \case
-      ""                  -> False
-      x | Path.hasDrive x -> False
-      c:_                 -> Path.isPathSeparator c
-
-    dropAbs x = if leadingPathSepOnWindows x then tail x else Path.dropDrive x
-
-    takeAbs x = if leadingPathSepOnWindows x
-                then [Path.pathSeparator]
-                else map (\y ->
-                            if Path.isPathSeparator y
-                            then Path.pathSeparator
-                            else toLower y)
-                         (Path.takeDrive x)
+ | Path.takeDrive root /= Path.takeDrive path = path
+ | otherwise =
+   let toParts = Path.splitDirectories . Path.normalise
+       go (pp:pps) (rp:rps)
+         | pp == rp = go pps rps
+       go pps rps
+         = Path.joinPath $ replicate (length rps) ".." ++ pps
+   in go (toParts path) (toParts root)
+makeRelative path root _unsafe = Path.makeRelative root path
 
 -- | First published version of this library.
 initialVersion :: Version
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hslua-module-path-1.0.2/test/test-path.lua 
new/hslua-module-path-1.0.3/test/test-path.lua
--- old/hslua-module-path-1.0.2/test/test-path.lua      2001-09-09 
03:46:40.000000000 +0200
+++ new/hslua-module-path-1.0.3/test/test-path.lua      2001-09-09 
03:46:40.000000000 +0200
@@ -145,29 +145,57 @@
   },
 
   group 'make_relative' {
-    test('just the filename if file is within path', function()
-      assert.are_equal(
-        path.make_relative('/foo/bar/file.txt', '/foo/bar'),
-        'file.txt'
-      )
-    end),
-    test('no change if name outside of reference dir', function()
-      assert.are_equal(
-        path.make_relative('/foo/baz/file.txt', '/foo/bar'),
-        '/foo/baz/file.txt'
-      )
-    end),
-    test('use `..` when allowing unsafe operation', function()
-      assert.are_equal(
-        path.make_relative('/foo/baz/file.txt', '/foo/bar', true),
-        path.join{'..', 'baz', 'file.txt'}
-      )
-    end),
-    test('return dot if both paths are the same', function()
-      assert.are_equal(
-        path.make_relative('/one/two/three', '/one/two/three/'),
-        '.'
-      )
-    end)
+    group 'safe' {
+      test('just the filename if file is within path', function()
+        assert.are_equal(
+          path.make_relative('/foo/bar/file.txt', '/foo/bar'),
+          'file.txt'
+        )
+      end),
+      test('no change if name outside of reference dir', function()
+        assert.are_equal(
+          path.make_relative('/foo/baz/file.txt', '/foo/bar'),
+          '/foo/baz/file.txt'
+        )
+      end),
+      test('return dot if both paths are the same', function()
+        assert.are_equal(
+          path.make_relative('/one/two/three', '/one/two/three/'),
+          '.'
+        )
+      end),
+    },
+    group 'unsafe' {
+      test('just the filename if file is within path', function()
+        assert.are_equal(
+          path.make_relative('/foo/bar/file.txt', '/foo/bar', true),
+          'file.txt'
+        )
+      end),
+      test('use `..` to reach parent directory', function()
+        assert.are_equal(
+          path.make_relative('/foo/baz/file.txt', '/foo/bar', true),
+          path.join{'..', 'baz', 'file.txt'}
+        )
+      end),
+      test('no change if base differs', function()
+        assert.are_equal(
+          path.make_relative('foo/baz/file.txt', '/foo/bar', true),
+          'foo/baz/file.txt'
+        )
+      end),
+      test('long base path ', function()
+        assert.are_equal(
+          path.make_relative('a/d.png', 'a/b/c', true),
+          path.join{'..', '..', 'd.png'}
+        )
+      end),
+      test('return dot if both paths are the same', function()
+        assert.are_equal(
+          path.make_relative('/one/two/three', '/one/two/three/', true),
+          '.'
+        )
+      end)
+    }
   },
 }

Reply via email to