conan icon indicating copy to clipboard operation
conan copied to clipboard

[bug] Failed to fetch correct commit

Open bethmal opened this issue 1 year ago • 3 comments

Describe the bug

Windows10 version 22H2. conan 1.58.0

Description: When start "conan build" with specified gitlab scm, conan did not fetch the correct commit. Seems command "git -c http.sslVerify=true checkout FETCH_HEAD" sets an unexpected commit finally. We have no ideas how this happens, but this for sure brings serious problem.

Conan Infor: INFO :runners.py [87]: Calling command: git -c http.sslVerify=true init > "C:\Users\xxxxxx\AppData\Local\Temp\tmpuzrqlqcj\output" [2024-04-17 11:28:38,853] INFO :runners.py [90]: Return code: 0 [2024-04-17 11:28:39,296] INFO :runners.py [98]: Output: in file:Initialized empty Git repository in D:/myfolder/.conan/data/mypackage/1.12.1/username/stable/source/.git/

                        stdout: None
                        stderr:b'' [2024-04-17 11:28:39,304]

INFO :runners.py [87]: Calling command: git -c http.sslVerify=true remote add origin "[email protected]" > "C:\Users\xxxxxx\AppData\Local\Temp\tmp8mmc7u9w\output" [2024-04-17 11:28:39,308]
INFO :runners.py [90]: Return code: 0 [2024-04-17 11:28:39,551] INFO :runners.py [98]: Output: in file: stdout: None stderr:b'' [2024-04-17 11:28:39,551] INFO :runners.py [87]: Calling command: git -c http.sslVerify=true fetch --depth 1 origin "16759640c58d64b8c735e818eee44208bf24ec8b" > "C:\Users\xxxxxx\AppData\Local\Temp\tmpa54dm62d\output" [2024-04-17 11:28:39,555] INFO :runners.py [90]: Return code: 0 [2024-04-17 11:28:47,389] INFO :runners.py [98]: Output: in file: stdout: None stderr:b'From mypackage\n * branch 16759640c58d64b8c735e818eee44208bf24ec8b -> FETCH_HEAD\n' [2024-04-17 11:28:47,390] INFO :runners.py [87]: Calling command: git -c http.sslVerify=true checkout FETCH_HEAD > "C:\Users\xxxxxx\AppData\Local\Temp\tmpuw_a38b5\output" [2024-04-17 11:28:47,393] INFO :runners.py [90]: Return code: 0 [2024-04-17 11:28:47,683] INFO :runners.py [98]: Output: in file: stdout: None stderr:b"Note: switching to 'FETCH_HEAD'.\n\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by switching back to a branch.\n\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -c with the switch command. Example:\n\n git switch -c \n\nOr undo this operation with:\n\n git switch -\n\nTurn off this advice by setting config variable advice.detachedHead to false\n\nHEAD is now at b65653d feat:syn ELC code construct baseline\n" [2024-04-17 11:28:47,683]

How to reproduce it

No response

bethmal avatar Apr 17 '24 06:04 bethmal

Hi @bethmal

Thanks for your question.

This is not very clear, seems something specific to your Gitlab runner. If it is something in Conan, could you please provide a conanfile.py recipe and instructions how can we reproduce it in our end? Thanks!

conan 1.58.0

This would be outdated, please try to update to latest Conan 1.X, and prepare your upgrade to Conan 2, which was released more than one year ago, and for example it is planned that ConanCenter will stop updating Conan 1 packages soon.

memsharded avatar Apr 17 '24 08:04 memsharded

Hi @memsharded

Thanks for the replies.

I will be looking at the new versions.

Would it be possible to check the FETCH_HEAD with the scm commit specified in conanfile.py after fetches the source code? At least users know there is mismatch detected. Otherwise, you know this kind of error is hard to catch but brings serious result for developers.

Thanks.

bethmal avatar Apr 22 '24 08:04 bethmal

Would it be possible to check the FETCH_HEAD with the scm commit specified in conanfile.py after fetches the source code?

Not sure what you mean. Fetching the head would be breaking, violating the immutability principle of the sources and breaking reproducibility. In the docs, it is described how source retrieval should always retrieve the exact same source.

memsharded avatar Apr 22 '24 09:04 memsharded