Skip to content

Fix compatibilities with unix >=2.8 package #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

a5ob7r
Copy link

@a5ob7r a5ob7r commented Oct 1, 2022

Since version 2.8, the unix package changed UserEntry and GroupEntry into the ByteString based implementation instead of String as a breaking change. We can compile this package with unix >=2.8 if just re-exports the two of new data types, but it's probably uncomfortable for users because types of fields of the two isn't the same between prior 2.8 and since 2.8. So we need to define and export compatible data types for UserEntry and GroupEntry to resolve this problem.

This patch provides API compatibilities not between platforms but between versions of library, so the compat which this patch provide isn't probably the same as the compat which this package provides.

Fix #57.

Since version 2.8, the unix package changed `UserEntry` and `GroupEntry`
into the `ByteString` based implementation instead of `String` as a
breaking change. We can compile this package with unix >=2.8 if just
re-exports the two of new data types, but it's probably uncomfortable
for users because types of fields of the two isn't the same between
prior 2.8 and since 2.8. So we need to define and export compatible data
types for `UserEntry` and `GroupEntry` to resolve this problem.
Copy link

@mmhat mmhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just got hit by that myself. Thank you for fixing that! 👍

@@ -37,7 +40,78 @@ module System.PosixCompat.User (

#include "HsUnixCompat.h"

#ifdef UNIX_2_8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use MIN_VERSION_unix(2, 8, 0) here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. I didn't know the MIN_VERSION_* macro. It seems that It's used at other points in this package. I'll use it. No need to use an extra flag if use it.

@@ -26,6 +26,9 @@ flag old-time
description: build against old-time package
default: False

flag unix28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasoning behind introducing an extra flag?

Use MIN_VERSION* macro to branch code by versions of unix package.
@mitchellwrosen
Copy link

mitchellwrosen commented Dec 1, 2022

Friendly bump.

Btw, another option to work around this incompatibility, @a5ob7r, is to release a new version of unix-compat that only supports unix ^>= 2.8. Users who need an older version of unix can simply use older versions of unix-compat, too.

@mitchellwrosen
Copy link

I think the right fix for this is to just delete System.PosixCompat.User. It doesn't contain any helpful cross-platform functionality. I've opened that PR here: #62

@mitchellwrosen
Copy link

Thanks for the PR, but we've deleted System.PosixCompat.User entirely, so it's no longer needed. You can find the new repository here https://github.com/haskell-pkg-janitors/unix-compat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails with unix ^>=2.8 even though cabal file claims to support it
3 participants