Skip to content
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

ipaclient/ipapython macOS compatibility fixes #699

Closed
wants to merge 2 commits into from
Closed

ipaclient/ipapython macOS compatibility fixes #699

wants to merge 2 commits into from

Conversation

neffs
Copy link
Contributor

@neffs neffs commented Apr 7, 2017

libkrb5.so.3 is called libkrb5.dylib on macOS

@abbra
Copy link
Contributor

abbra commented Apr 7, 2017

Thanks. Do you have IPA client code working on Mac OS X?

@neffs
Copy link
Contributor Author

neffs commented Apr 7, 2017

It connects via RPC and user-show works. Didn't check much further.

I also created an issue: https://pagure.io/freeipa/issue/6850

EDIT: I tried it on another computer but currently python-nss fails. I'll check.

@abbra
Copy link
Contributor

abbra commented Apr 7, 2017

Ok. Let me look at it next week when I'll have time. Could you please add a short step by step instruction how you configured IPA client on Mac OS X?

@abbra abbra self-requested a review April 7, 2017 12:49
@abbra
Copy link
Contributor

abbra commented Apr 7, 2017

There is a PEP8 error:
PEP-8 errors:

./ipapython/session_storage.py:11:21: E225 missing whitespace around operator

@neffs
Copy link
Contributor Author

neffs commented Apr 7, 2017

I added the steps here: https://pagure.io/freeipa/issue/6850

@@ -7,9 +7,12 @@

KRB5_CC_NOSUPP = -1765328137

LIBKRB5_FILENAME = 'libkrb5.so.3'
if platform.system() == "Darwin":
Copy link
Member

Choose a reason for hiding this comment

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

Please import the sys module and use use sys.platform

import sys
...
if sys.platform == 'darwin':
    LIBKRB5_FILENAME = 'libkrb5.dylib'
else:
    LIBKRB5_FILENAME = 'libkrb5.so.3'

@tiran
Copy link
Member

tiran commented Apr 7, 2017

@neffs thanks David. Please squash your commits into a single commit (git rebase -i @~3 and use fixup on the 2nd and 3rd commit, then git push --force).

Signed-off-by: David Kreitschmann <david@kreitschmann.de>
Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks a lot for your contribution!

I'm giving your PR a provisional ACK. Travis CI will take a while to finish (at least 30 minutes).

@neffs neffs changed the title Fix libkrb5 filename for macOS macOS compatibility fixes Apr 7, 2017
@neffs neffs changed the title macOS compatibility fixes ipaclient/ipapython macOS compatibility fixes Apr 7, 2017
…atasync

Signed-off-by: David Kreitschmann <david@kreitschmann.de>
Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

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

fdatasync -> fsync is ok, too.

Next time, please don't add a new patch to an approved PR. It is easier for us when you create a new PR instead.

@tiran tiran added the ack Pull Request approved, can be merged label Apr 10, 2017
@abbra abbra removed the ack Pull Request approved, can be merged label Apr 10, 2017
@abbra
Copy link
Contributor

abbra commented Apr 10, 2017

Please don't set ACK yet, I'm not finished with review.

I do not want to replace fdatasync() with fsync(), this is not correct towards other platforms.
I haven't yet tested this pull request against Mac OS X, so do not set ACK yet.

@abbra
Copy link
Contributor

abbra commented Apr 10, 2017

Note that we need something similar to untitaker/python-atomicwrites@2bdd9da to behave properly on Mac OS X.

@tiran
Copy link
Member

tiran commented Apr 10, 2017

I wrote that fdatasync -> fsync is fine. It's my code after all.

Explanation: fdatasync is a slightly optimized version of fsync that does not flush some metadata to disk, https://linux.die.net/man/2/fdatasync

fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, changes to st_atime or st_mtime (respectively, time of last access and time of last modification; see stat(2)) do not require flushing because they are not necessary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush.

When I write the code, I chose fdatasync because st_mtime isn't strictly required for the cache files. fdatasync is a micro-optimization that fails under macOS. Instead of making the code even more complicated, I have approved the platform agnostic fsync syscall. It doesn't hurt to flush all data to disk. The files are rarely written anyway.

@tiran
Copy link
Member

tiran commented Apr 10, 2017

No, we don't need to sync the directory. These are cache files. It's only important that we don't have half-written cache files on disk. A missing cache file is fine.

@abbra
Copy link
Contributor

abbra commented Apr 10, 2017

I still need to test the whole set on Mac OS X myself as we have no way to test that in CI. Thus, this PR will depend on me (or some one else from FreeIPA team) to actually test the code on Mac OS X.

@abbra
Copy link
Contributor

abbra commented Apr 10, 2017

Ok, so far I cannot build a wheel from git repo on Mac OS X as we have a number of limitations ourselves -- we need to fix our configure to allow just generating enough of ipasetup.py and make files to run python wheels code. I'll supply a separate PR for this.

@tiran
Copy link
Member

tiran commented Apr 19, 2017

@abbra is there any reason to delay the merge? I like to get the fixes into 4.5 for the upcoming 4.5.1 release. This commit may not be sufficient for full macOS support, but it's definitely required for macOS support. There is no harm to commit it now and fix remaining issues later.

@abbra
Copy link
Contributor

abbra commented Apr 19, 2017

Well, given that it is not officially supported yet, go ahead.

@pvoborni
Copy link
Member

IMO this can be put to 4.5.1 (ipa-4-5 branch) but in order to do it, according to FreeIPA devel processes, it needs to be attached (have a ticket link in commit message) to opened issue in 4.5.1 milestone. Otherwise it will go only to master branch (future 4.6). If this fixes 6850, then it can be reopended for it. Otherwise please open a new issue with reasoning.

@stlaz stlaz added the ack Pull Request approved, can be merged label May 17, 2017
@stlaz
Copy link
Contributor

stlaz commented May 17, 2017

This got an ACK during the last developers' meeting.

@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label May 17, 2017
@MartinBasti
Copy link
Contributor

master:

  • b8b28c3 Fix libkrb5 filename for macOS
  • f1c6a5d Use os.fsync instead of os.fdatasync because macOS doesn't support fdatasync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
6 participants