Skip to content

Re-adding execvpe support, conditional on platform #683

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

Closed
wants to merge 2 commits into from
Closed

Re-adding execvpe support, conditional on platform #683

wants to merge 2 commits into from

Conversation

panzertime
Copy link

Fixes #682

@Susurrus
Copy link
Contributor

You'll need to do a few more things:

  • replace super::ffi::execvpe with libc::execvpe
  • Change the last line to use Error::result like in the function above this one.
  • There should be good documentation for this function. See some of the other PRs that were recently merged for good examples.

Copy link
Contributor

@Susurrus Susurrus left a comment

Choose a reason for hiding this comment

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

Looking pretty good. Also needs a CHANGELOG entry and to have all commits except for the one that changes the libc dependency to be squashed into one (see the git rebase command).

src/unistd.rs Outdated
/// * `env`: array of environment variables for the new execution environment
/// * returns: Ok or libc error code.
///
/// Err is returned if the executable file does not exist, cannot be accessed, or
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of "Err" use "An error"

src/unistd.rs Outdated
};

Err(Error::Sys(Errno::last()))
Errno::result(res).map(drop)
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation here is off by 1.

@panzertime
Copy link
Author

panzertime commented Jul 18, 2017

I have made all the requested changes, but I cannot squash all the changes into two commits as described. I've tried git rebase -i HEAD~6 and marking everything except the first commit as squash, but then git tells me it can't do it

src/unistd.rs Outdated
/// Replaces the current process image with a new one.
/// ([see exec(3)](http://man7.org/linux/man-pages/man3/exec.3.html))
///
/// * `filename`: filename of executable to run
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give a title or quick sentence to introduce this bulleted list? It doesn't read nicely just being a stand alone list.

src/unistd.rs Outdated
/// * `env`: array of environment variables for the new execution environment
/// * returns: Ok or libc error code.
///
/// An error is returned if the executable file does not exist, cannot be accessed, or
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a special section called Errors that you should use for these kinds of things. See the book.

src/unistd.rs Outdated
/// * `filename`: filename of executable to run
/// * `args`: array of arguments as strings; first must be the filename
/// * `env`: array of environment variables for the new execution environment
/// * returns: Ok or libc error code.
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be handled by the Errors section below.

@Susurrus
Copy link
Contributor

I would like to get these commits squashed, you said you couldn't do that, is that because you aren't familiar with git rebase? Here's a quick overview if that's all you're missing.

@panzertime
Copy link
Author

I followed the exact procedure described there and the rebase failed.

@Susurrus
Copy link
Contributor

You'll need to fix merge commits when you rebase sometimes, so if there's a conflict it isn't a "failure" it just means you need to manually merge some of the code.

@panzertime
Copy link
Author

Well, if that's the case, someone else needs to do it.

@Susurrus
Copy link
Contributor

This isn't that bad to fix and it's probably worth getting a little bit more familiar with git if you're going to be doing more software dev work. And I've been where you are and had to struggle through it a bit, but the solution to this is pretty easy: undo all of your commits locally, rebase to the latest upstream/master (I'm assuming the primary repo is your upstream here), and then make your two commits.

This looks like:

  1. git fetch upstream - Make sure you have the latest nix code to reference
  2. git reset upstream/master - This will keep all your changes but unstage them and undo all of the commits. You'll now be at the same commit as upstream/master but with none of your changes applied.
  3. git commit CHANGELOG.md -m"Switch back to using libc git"
  4. `git commit -a -m"Re-add execvpe for Haiku, OpenBSD, and Linux"
  5. git push origin -f - Overwrite the remote branch. Since this replaces existing commits you need to use the -f. Thinking about this now, I'm wondering if this isn't the failure you were talking about above.

Now, if more changes need to be made:

  1. git commit -a --amend - Just amend the existing commit with any new changes.
  2. git push origin -f - Since you'll have rewritten the git history, you'll need to force-push again here.

Let me know if you get stuck doing any of that. Hopefully it all makes sense now!

@panzertime
Copy link
Author

fatal: 'upstream' does not appear to be a git repository

@Susurrus
Copy link
Contributor

You may have it called "origin"; do git remote -v to see the names of things. I have "origin" set to my fork of a repository and I use "upstream" to refer to the upstream repo.

@panzertime
Copy link
Author

There was no remote set for the upstream repo.

@Susurrus
Copy link
Contributor

Yeah, the default would be to have "origin" set to your repo. So let's add an upstream:

  • git remote add upstream https://github.com/nix-rust/nix
  • git fetch upstream

@panzertime
Copy link
Author

I already did that.

@Susurrus
Copy link
Contributor

What's the output of git remote -v for you then?

@panzertime
Copy link
Author

Have you noticed that there are new commits?

@Susurrus
Copy link
Contributor

Oh, perfect, I did not. I've been squatting on this page and GitHub's terrible at dealing with force-pushing things, so I was still seeing 12 commits or whatever.

So this wraps in some changes that are part of the commits in #681 into your own commits, which isn't ideal, but fine. What we'll do is wait until that's merged, rebase this (which will get rid of all of those code changes) and then this'll be ready to merge!

Thanks for sticking with this, git can be really frustrating sometimes, but I've found it quite powerful now that I've really gotten the hang of it.

@Susurrus
Copy link
Contributor

@panzertime Want to rerebase this and clean up the remaining issues? This is pretty close to merging.

@panzertime
Copy link
Author

What issues remain?

@@ -24,6 +24,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
and nix::Error::UnsupportedOperation}`
([#614](https://github.com/nix-rust/nix/pull/614))
- Added `cfmakeraw`, `cfsetspeed`, and `tcgetsid`. ([#527](https://github.com/nix-rust/nix/pull/527))
- Readded execvpe support, conditional on platform. libc now provides this for Haiku, Linux, and OpenBSD.
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to "Added unistd::execvpe for Haiku, Linux, and OpenBSD."

@Susurrus
Copy link
Contributor

Just the CHANGELOG entry should be more clear & concise. Otherwise this needs a rebase and then it should be good. Though I want to take another look over it once it's rebased as it's hard to tell what the actual changes are here since there are some other things that seem mixed in here.

@Susurrus
Copy link
Contributor

Susurrus commented Aug 1, 2017

@panzertime Just pinging you on this since we were getting pretty close to merging this. Can you rebase and address my comments?

@Susurrus
Copy link
Contributor

Susurrus commented Sep 5, 2017

@panzertime It's been a month since I last pinged you, so I wanted to do that again and see if we could get this merged.

@Susurrus
Copy link
Contributor

@panzertime I think it's just the changelog entry now and a rebase and this is good to go. Still interested in merging this?

@Susurrus
Copy link
Contributor

Susurrus commented Dec 4, 2017

It's been almost 5 months on this with several pings, so I'm going to go ahead and close this PR.

@Susurrus Susurrus closed this Dec 4, 2017
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.

2 participants