Travis CI bug in macOS environment #17178 workaround #17202

pull sadrasabouri wants to merge 12 commits into bitcoin:master from sadrasabouri:issue#17178 changing 2 files +33 −15
  1. sadrasabouri commented at 5:11 pm on October 20, 2019: none

    According to #17178 by MarcoFalke, cd command (using for changing directory) has some conflicts with Travis builtin command with similar name in some environments (like macOS).

    In this PR :

    1. I tried to solve this issue by replacing cd by type cd in ci/test/06_script_a.sh and ci/test/06_script_b.sh .
    2. I added function called safe_cd as commented in here to avoid duplication in code.
  2. fanquake added the label Tests on Oct 20, 2019
  3. sadrasabouri closed this on Oct 20, 2019

  4. sadrasabouri renamed this:
    Issue#17178
    Travis CI bug in macOS environment solved #17178
    on Oct 20, 2019
  5. sadrasabouri renamed this:
    Travis CI bug in macOS environment solved #17178
    Travis CI bug in macOS environment #17178 solved
    on Oct 20, 2019
  6. fix : travis macOS enviroment bug fixed #17178 8916e1dd8a
  7. sadrasabouri reopened this on Oct 20, 2019

  8. add : safe_cd function added to script_a.sh 277864eb7b
  9. add : safe_cd function added to script_b.sh 0504690bc5
  10. sadrasabouri closed this on Oct 20, 2019

  11. Sjors commented at 9:19 am on October 21, 2019: member
    Why did you close this? I think safe_cd is a reasonable workaround. But I would change the PR title, because it doesn’t really “solve” the problem.
  12. sadrasabouri commented at 11:23 am on October 21, 2019: none
    @Sjors Ok Thanks. I’ll reopen the pull request. what can i use instead of “solve”?
  13. sadrasabouri reopened this on Oct 21, 2019

  14. test : cd command replaced with type cd for macOS in Travis test c8e32b715a
  15. fix : extra space for assignments removed 6b9127aa43
  16. laanwj commented at 11:23 am on October 22, 2019: member

    I’m OK with this if it solves a problem.

    But to be honest I think this is terrible. Even a basic command that has existed since the 70’s like cd needs a workaround these days? This makes it impossible to do shell scripting sanely. Are you going to review new code for using the right cd variant?

  17. in ci/test/06_script_a.sh:14 in 6b9127aa43 outdated
     5@@ -6,6 +6,18 @@
     6 
     7 export LC_ALL=C.UTF-8
     8 
     9+lcd=cd
    10+if [[ "$OSTYPE" == "darwin"* ]]; then
    11+  lcd=type cd
    12+fi
    13+
    14+safe_cd()
    


    laanwj commented at 11:25 am on October 22, 2019:
    at least add a comment for this workaround here: why this is needed, and when it can be removed again

    sadrasabouri commented at 12:58 pm on October 22, 2019:
    Ok, thanks. I’ll add.
  18. fanquake added the label Waiting for author on Oct 22, 2019
  19. sadrasabouri commented at 12:57 pm on October 22, 2019: none

    I’m OK with this if it solves a problem.

    But to be honest I think this is terrible. Even a basic command that has existed since the 70’s like cd needs a workaround these days? This makes it impossible to do shell scripting sanely. Are you going to review new code for using the right cd variant?

    Unfortunately Travis CI is in it’s Betha version and has several bugs in macOS environment. In this specific issue, i am going to use type cd instead of cd in macOS and continue using cd for other operating systems. In macOS, Travis considers cd command as it’s built-in Travis command and not as a shell scripting command :cry:.

  20. MarcoFalke commented at 1:18 pm on October 22, 2019: member

    In macOS, Travis considers cd command as it’s built-in Travis command and not as a shell scripting command cry.

    why? is there any documention available? What would happen if we forced it to use the shell built in?

  21. improve : command assignment improved 92bf12e842
  22. add : comments are added to scripts bcaf0f3733
  23. sadrasabouri renamed this:
    Travis CI bug in macOS environment #17178 solved
    Travis CI bug in macOS environment #17178 workaround
    on Oct 22, 2019
  24. sadrasabouri commented at 5:27 pm on October 22, 2019: none

    In macOS, Travis considers cd command as it’s built-in Travis command and not as a shell scripting command cry.

    why? is there any documention available? What would happen if we forced it to use the shell built in?

    I really don’t know :disappointed: I searched for a document for this specific issue, but i didn’t find one. Actually there is some issues in Travis repository like this that concerns about similar problem.

    How can i force Travis to use shell built in? Any help will be appreciated :hand:

  25. MarcoFalke commented at 5:32 pm on October 22, 2019: member
    So what is the output of which cd, type cd and command -v cd?
  26. ryanofsky commented at 5:36 pm on October 22, 2019: member

    How can i force Travis to use shell built in?

    We should use which / type as marco suggested to actually debug this and figure out the problem so it can be fixed upstream. But replacing cd with command cd would force using the built in.

  27. sadrasabouri commented at 5:54 pm on October 22, 2019: none

    How can i force Travis to use shell built in?

    We should use which / type as marco suggested to actually debug this and figure out the problem so it can be fixed upstream. But replacing cd with command cd would force using the built in.

    Thank you for your help :+1: So i am going to use command cd instead of cd in all OSs(including macOs and …) and use type cd before any usage of command cd in code for future debug in upstream. Did i understand you right?

  28. MarcoFalke commented at 6:01 pm on October 22, 2019: member
    No, without knowing what the result (output) of type cd and which cd is, there is nothing we can do
  29. test : (type cd) and (which cd) command added for debug ea946a1440
  30. fix : (which cd) replaced by (command -V cd) bf62932f11
  31. fix : unused codes are now commented 5feb07aa2f
  32. MarcoFalke commented at 12:54 pm on October 23, 2019: member

    https://travis-ci.org/bitcoin/bitcoin/jobs/601781884#L228

    says

    0cd is a function
    1
    2cd () 
    3
    4{ 
    5
    6    __zsh_like_cd cd "$@"
    7
    8}
    
  33. MarcoFalke commented at 12:56 pm on October 23, 2019: member
    Anyone has any idea how to overwrite this cd? Can we use pushd maybe?
  34. ryanofsky commented at 1:28 pm on October 23, 2019: member

    Anyone has any idea how to overwrite this cd? Can we use pushd maybe?

    pushd probably won’t help: https://github.com/rvm/rvm/blob/ad02fb2c7ae77c7fd92a4f68766a2c8140766d08/scripts/cd#L14-L16

    I think we should debug this further (maybe turn on set -x or look at type __zsh_like_cd output) and figure out why the __zsh_like_cd function is dying on mac with errexit, then report the issue to travis so it can be fixed, and in the meantime add a safe_cd function that either calls command cd or just toggles errexit before calling regular cd.

  35. ryanofsky commented at 1:39 pm on October 23, 2019: member
  36. MarcoFalke commented at 1:54 pm on October 23, 2019: member
  37. Sjors commented at 2:36 pm on October 23, 2019: member
    pushd definitely doesn’t help; I tried that before.
  38. fix : some commandsa are displaced 582fff92dc
  39. remove : command +V removed cf51d62e75
  40. DrahtBot commented at 3:10 am on November 9, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17423 (ci: Make ci system read-only on the git work tree by MarcoFalke)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  41. MarcoFalke added the label Up for grabs on Nov 20, 2019
  42. MarcoFalke removed the label Waiting for author on Nov 20, 2019
  43. DrahtBot commented at 10:27 pm on November 20, 2019: member
  44. DrahtBot added the label Needs rebase on Nov 20, 2019
  45. fanquake closed this on Nov 21, 2019

  46. MarcoFalke removed the label Up for grabs on Nov 21, 2019
  47. fanquake removed the label Needs rebase on Aug 20, 2020
  48. fanquake locked this on Aug 20, 2020

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me