Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Ensure functionality of spacefish on the 3.0 release of fish #128

Merged
merged 29 commits into from
Jan 2, 2019

Conversation

matchai
Copy link
Owner

@matchai matchai commented Dec 28, 2018

Description

All the following changes should be backward compatible with fish 2.7.1:

  • Change stderr redirects to be 2> instead of ^
  • Resolve to physical PWD when truncating git root
  • Remove Appveyor and Cygwin-specific testing logic
  • Add Fish 2.X and Fish 3.X tests to Travis

Motivation and Context

Closes #127

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • I have tested using MacOS
  • I have tested using Linux

Checklist:

  • I have checked that no other PR duplicates mine
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@matchai matchai added the Type: Maintenance Non-functional changes (testing, project structure, CI, etc.) label Dec 28, 2018
Matan Kushner added 2 commits December 28, 2018 14:19
Fish plans to deprecate caret stderr redirection in favor of POSIX-compatible redirection (fish-shell/fish-shell#4394)
@matchai
Copy link
Owner Author

matchai commented Dec 28, 2018

I'm having a heck of a time trying to figure out what is causing this failure.
This would be a whole lot easier if the test runner would escape all backslash characters and color codes so that we can more easily debug 🤔
Edit: Oh! We totally can by looking at the travis log!

I was thinking it had to do with the new fish_ambiguous_width and fish_emoji_width variables, but messing with those locally still causes the same failures.

@matchai
Copy link
Owner Author

matchai commented Dec 28, 2018

After a little bit of chatting on the fish-shell gitter, this bit of advice might help us isolate the failure:
image

@matchai matchai added Help Wanted Extra attention is needed and removed Help Wanted Extra attention is needed labels Dec 29, 2018
@matchai
Copy link
Owner Author

matchai commented Dec 29, 2018

Here's the rest of the conversation, where @faho discusses the solution he found:
image

The failure was resolved in the end with the following PR to fishtape: jorgebucaran/fishtape#35

@matchai
Copy link
Owner Author

matchai commented Dec 29, 2018

Hmm... 🤔
Now we've got a new failure to do with identifying the root of a git repo.
This also doesn't happen outside of tests and only seems to affect the Travis run.

Matan Kushner added 2 commits December 29, 2018 14:58
It appeared that pwd -P was only added as part of fish 3.0.0 and would
not be available on fish 2.7.1
@@ -27,11 +27,12 @@ function __sf_section_dir -d "Display the current truncated directory"

set -l dir
set -l tmp
set -l resolvedPwd (pwd -P 2>/dev/null)
Copy link

Choose a reason for hiding this comment

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

For easy compatibility with 2.7.0, put ; or pwd in there, because that didn't have the -P option and will error out.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Unfortunately, this causes a bug on 2.7.0 due to pwd being the logical location while the git root is a physical location.
It seems to work consistently now when using command pwd -P. Do you see any drawbacks to this approach?

Copy link

Choose a reason for hiding this comment

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

Unfortunately, this causes a bug on 2.7.0 due to pwd being the logical location while the git root is a physical location.

In 2.7.0, the pwd is the physical location, always.

So pwd prints the same thing in 2.7.0, as pwd -P does in 3.0.

Using just pwd causes a bug in 3.0, not 2.7.

Just to be clear, my proposal is:

set -l resolvedPWD (pwd -P 2>/dev/null; or pwd)

which will try pwd -P, which will fail if the option isn't supported, and then it'll run pwd.

It seems to work consistently now when using command pwd -P. Do you see any drawbacks to this approach?

It's an additional fork (command pwd takes a millisecond or so on my system, hot-cache, while the builtin is unmeasurable). Plus, it's an additional external command you require.

pwd (with -P) is a POSIX requirement, but still.

Not something that's hugely important.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Excellent! Yes, you're right. It was 3.0 that caused the bug.
Thank you for the clarification. 😄

@matchai
Copy link
Owner Author

matchai commented Dec 29, 2018

I've gone ahead and removed Appveyor and Cygwin-related testing from the project.
Appveyor has been consistently triggering false positives which are not reproducible on my local Cygwin installation, causing us to add logic specifically for Appveyor test runs.

I'll look into re-adding Cygwin (and possibly WSL) coverage with Travis in a future PR. 👍

@matchai matchai requested a review from Snuggle December 29, 2018 21:38
@matchai matchai changed the title [WIP] Ensure functionality of spacefish on the 3.0 release of fish Ensure functionality of spacefish on the 3.0 release of fish Dec 29, 2018
Copy link
Collaborator

@Snuggle Snuggle left a comment

Choose a reason for hiding this comment

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

It seems fishtape is having compatibility issues, heh.
https://travis-ci.org/matchai/spacefish/jobs/473447715#L149

@matchai
Copy link
Owner Author

matchai commented Dec 29, 2018

So it seems... 🤔
It appears our tests are still running correctly, regardless. 🤷‍♂️

@@ -4,6 +4,10 @@ function setup
spacefish_test_setup
end

function teardown
set USER $LOGNAME
Copy link
Owner Author

Choose a reason for hiding this comment

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

This will reset the user to be the username that initially logged in.
It seems this wasn't being reset after setting user to "ROOT".

@matchai matchai merged commit 16539f5 into master Jan 2, 2019
matchai pushed a commit that referenced this pull request Jan 2, 2019
## [1.12.4](v1.12.3...v1.12.4) (2019-01-02)

### Bug Fixes

* fix bugs caused by the 3.0 release of fish ([#128](#128)) ([16539f5](16539f5))
@matchai
Copy link
Owner Author

matchai commented Jan 2, 2019

🎉 This PR is included in version 1.12.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@@ -18,7 +18,7 @@
#

function mock -a cmd -a argument -a exit_code -a executed_code -d "Mock library for fish shell testing"
set -l cmd_blacklist "builtin" "functions" "eval" "command"
set -l cmd_blacklist "builtin" "functions" "eval" "command" "argparse" "read" "set" "status" "test"
Copy link

Choose a reason for hiding this comment

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

This is missing [, the alternate name for test. Though, technically, there's a few more. See https://github.com/fish-shell/fish-shell/blob/master/src/parser_keywords.cpp. So the list is

"[" and argparse begin break builtin case command continue else end exec for function if not or read return set status switch test while

(yes, [ is the only one that needs to be quoted)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a pain in the butt to maintain as things are added over time. Can fish do this for us? Is there a command to list all builtins automatically?

@faho
Copy link

faho commented Jan 9, 2019 via email

@matchai matchai deleted the fish-3.0 branch January 9, 2019 15:39
@Snuggle
Copy link
Collaborator

Snuggle commented Feb 7, 2019

@matchai Could we possibly replace this list of builtins with the above? It seems like it would be much easier to maintain.

@matchai
Copy link
Owner Author

matchai commented Feb 7, 2019

As part of #136, the mock code is no longer in the repo.
In fish-mock, I've gone ahead and added the full list. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Status: Released Type: Maintenance Non-functional changes (testing, project structure, CI, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure functionality of spacefish on the 3.0 release of fish
3 participants