[Mac, Linux] refactor Mac platform into POSIX base#926
[Mac, Linux] refactor Mac platform into POSIX base#926jrbriggs merged 11 commits intomicrosoft:masterfrom
Conversation
| public const int ReadOnly = 0x0000; | ||
| public const int WriteOnly = 0x0001; | ||
|
|
||
| public const int Create = 0x0200; |
There was a problem hiding this comment.
We have the same problem here as in the file-lock code; this is 0x0040 on Linux, and the various chmod-related calls should use an uint. There may be other Linux vs. BSD changes here as well, so this probably needs to be refactored into a POSIX base with Linux and Mac extensions.
There was a problem hiding this comment.
There may be other Linux vs. BSD changes here as well, so this probably needs to be refactored into a POSIX base with Linux and Mac extensions.
@kivikakk, @chrisd8088, are you planning to make this change in this PR, or in a follow up PR?
There was a problem hiding this comment.
@kivikakk is away for a bit and as this is their work, I'm not looking to make any major changes to it right now. My own feeling at the moment is summarized by in my review comment:
To that end, the #810 PR (still a WIP) has a number of these modifications in it now, so using that as a basis for refactoring (maybe refactoring after that code has landed?) might be useful.
But I'll defer to @kivikakk to decide if they want to try to get the POSIX changes in first. For my part, I'm focused on looking at blockers to running gvfs mount on Linux, which is somewhat orthogonal work to this refactoring.
There was a problem hiding this comment.
@chrisd8088 ok thanks!
Regarding the status of this PR, I think it's close being ready to merge, there are just a few open comments left from the first round of review.
There was a problem hiding this comment.
I'd like to perform these changes later when we add the Linux platform in -- at that point we should refactor so that e.g. there's only one definition of any given native method for a given platform, whereas right now we have open and O_CREAT defined twice (in FileSystem and FileBasedLock).
It's pretty hard to get a refactor right when there's only one consumer of the code, and right now that's the case (Mac platform code is the single consumer of the POSIX platform base code). We'll maybe find more cases like this where Linux varies vs. what we've pre-emptively abstracted, but we should handle them as we implement the Linux platform in the tree, and not try to get this PR 100% correct before (imo). More important is that we get the initial refactor down asap so we don't get increasingly large deltas as time presses on.
There was a problem hiding this comment.
Sounds like a reasonable plan!
| @@ -1,42 +1,42 @@ | |||
| using GVFS.Platform.Mac; | |||
| using GVFS.Platform.POSIX; | |||
There was a problem hiding this comment.
One additional thought here is that we should presumably also rename this file to GVFSHooksPlatform.POSIX.cs and adjust the various *.csproj files to use that instead.
There was a problem hiding this comment.
There'll likely need to be one each for Mac and Linux since GetInstallerExtension will differ for both. It's a bit awkward; any thoughts? Could dump everything except GetInstallerExtension into GVFSHooksPlatform.POSIX, make the class partial, and then have a .Mac and .Linux variant with only GetInstallerExtension?
There was a problem hiding this comment.
Could dump everything except GetInstallerExtension into GVFSHooksPlatform.POSIX, make the class partial, and then have a .Mac and .Linux variant with only GetInstallerExtension?
That sounds good to me. I am okay with leaving the current code as-is and making that change in a follow up PR if you prefer.
There was a problem hiding this comment.
@kivikakk I just realized nothing is calling GetInstallerExtension anymore. Could you just remove it from this class (and the .Windows.cs version of this class)?
|
/azp run GitHub VFSForGit Mac Functional Tests |
2 similar comments
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
@kivikakk @chrisd8088, @kewillford and I have been unable to kick off the Mac functional tests and we suspect it may be due to the merge conflict in Could you resolve this conflict and we'll try kicking off the tests again? |
0450a84 to
c02a192
Compare
For ease of comparsion with the original Mac-only source files, we retain the line endings on the refactored POSIX common files to exactly match the original ones.
c02a192 to
262772e
Compare
|
OK @wilbaker, I've rebased on the latest |
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
No pipelines are associated with this pull request. |
Some constants differ per @chrisd8088's comment here: microsoft#926 (comment) When we add the Linux project, we should factor *out* of POSIXFileBasedLock what's Mac-specific.
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
No pipelines are associated with this pull request. |
|
Looks like Mac Functional Tests timed out after running for more than 3 hours (but passed as far as it got?). |
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
No pipelines are associated with this pull request. |
|
Suggestions taken up 👍 |
|
Curious if the following will work for me: |
|
/azp run GitHub VFSForGit Mac Functional Tests |
1 similar comment
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
No pipelines are associated with this pull request. |
wilbaker
left a comment
There was a problem hiding this comment.
Just one more minor file naming comment on the latest changes.
|
/azp run GitHub VFSForGit Mac Functional Tests |
|
No pipelines are associated with this pull request. |
|
Thanks for your patience with this! ❤️ |
Here's a refactor of the Mac platform into a POSIX base. (On my end, I did the full refactor of Mac and Linux platforms, then rebased away the Linux changes.) This PR does so without introducing the Mono dependency; just moving code around.
/cc @jrbiggs, #810
/cc @chrisd8088 fyi!