check50 icon indicating copy to clipboard operation
check50 copied to clipboard

Uploading throws an error

Open YalesRios opened this issue 4 years ago • 5 comments

When using the command check50 liv-ac-uk/COMP108/2020-21/A1

check50 outputs the following:

Connecting.......
Authenticating.....
GitHub username: YalesRios
GitHub password:
Verifying......
Preparing.................
Uploading.....
Traceback (most recent call last):
  File "/usr/local/bin/check50", line 33, in <module>
    sys.exit(load_entry_point('check50==3.2.0', 'console_scripts', 'check50')())
  File "/usr/local/lib/python3.9/site-packages/check50/__main__.py", line 336, in main
    commit_hash = lib50.push("check50", internal.slug, internal.CONFIG_LOADER, data={"check50": True})[1]
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 73, in push
    username, commit_hash = upload(slug, user, tool, data)
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 354, in upload
    _run(git("commit -m {msg} --allow-empty", msg=commit_message))
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 704, in _run
    command_output = child.read().strip().replace("\r\n", "\n")
  File "/usr/local/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 697, in _spawn
    raise Error()
lib50._errors.Error
Sorry, something is wrong! check50 ran into an error.
Please let CS50 know by emailing the error above to [email protected].

However, that does not happen when using the --local flag, like so: check50 --local liv-ac-uk/COMP108/2020-21/A1

In that case the check proceeds as normal.

This problem is present when using CS50 IDE terminal and also my own system.

YalesRios avatar Feb 09 '21 13:02 YalesRios

I'm having some trouble replicating this issue for myself:

/Projects/foo/ λ check50 liv-ac-uk/COMP108/2020-21/A1
Connecting.....
Authenticating....
GitHub username: Jelleas
GitHub password: 
Verifying............
Preparing.....
Uploading.............
Waiting for results..................................
Results for liv-ac-uk/comp108/2020-21/A1 generated by check50 v3.1.2
:( Attempt exists
    COMP108A1Paging.java not found

From the stack trace you shared, it looks to be a git commit that is failing somehow:

_run(git("commit -m {msg} --allow-empty", msg=commit_message))

But for reasons unknown!

Could you try running check50 --log-level debug liv-ac-uk/COMP108/2020-21/A1? This should hopefully tell us why git is failing to commit.

Jelleas avatar Feb 09 '21 14:02 Jelleas

Here is the output for

check50 --log-level debug liv-ac-uk/COMP108/2020-21/A1:

Connecting...
(DEBUG) db931eea90b1e95423bf90d657a37051f7c45432        refs/heads/2020-21
Authenticating...
(INFO) git credential fill
GitHub username: YalesRios
GitHub password:
(INFO) git -c credentialcache.ignoresighup=true credential approve
Verifying...
(INFO) git clone --bare https://[email protected]/me50/YalesRios .git
(DEBUG) Cloning into bare repository '.git'...
(DEBUG) remote: Enumerating objects: 9, done.
remote: Counting objects:  11% (1/9)
remote: Counting objects: 100% (9/9)
(DEBUG) remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (6/6), done.
(DEBUG) remote: Total 9 (delta 1), reused 6 (delta 1), pack-reused 0
(DEBUG) Unpacking objects:  11% (1/9)
(DEBUG) Unpacking objects:  22% (2/9)
(DEBUG) Unpacking objects:  33% (3/9)
(DEBUG) Unpacking objects:  44% (4/9)
(DEBUG) Unpacking objects:  55% (5/9)
(DEBUG) Unpacking objects:  66% (6/9)
(DEBUG) Unpacking objects:  77% (7/9)
(DEBUG) Unpacking objects:  88% (8/9)
Unpacking objects: 100% (9/9), 3.37 KiB | 3.37 MiB/s, done.
Preparing...
(INFO) git config --bool core.bare false
(INFO) git config --path core.worktree /tmp/tmptvbovtyp
(INFO) git checkout --force liv-ac-uk/comp108/2020-21/A1 .gitattributes
(DEBUG) error: pathspec 'liv-ac-uk/comp108/2020-21/A1' did not match any file(s) known to git
error: pathspec '.gitattributes' did not match any file(s) known to git
(DEBUG) git -C /tmp/tmptvbovtyp checkout --force liv-ac-uk/comp108/2020-21/A1 .gitattributes exited with 1
(INFO) git config user.email [email protected]
(INFO) git config user.name YalesRios
(INFO) git symbolic-ref HEAD refs/heads/liv-ac-uk/comp108/2020-21/A1
(INFO) git add -f COMP108A1PagingApp.java COMP108A1Output.java COMP108A1Paging.java
Uploading...
(INFO) git commit -m 'automated commit by check50 [check50=True]' --allow-empty
(DEBUG) fatal: cannot lock ref 'HEAD': 'refs/heads/liv-ac-uk/comp108/2020-21' exists; cannot create 'refs/heads/liv-ac-uk/comp108/2020-21/A1'
(DEBUG) git -C /tmp/tmptvbovtyp commit -m 'automated commit by check50 [check50=True]' --allow-empty exited with 128
Traceback (most recent call last):
  File "/usr/local/bin/check50", line 33, in <module>
    sys.exit(load_entry_point('check50==3.2.0', 'console_scripts', 'check50')())
  File "/usr/local/lib/python3.9/site-packages/check50/__main__.py", line 336, in main
    commit_hash = lib50.push("check50", internal.slug, internal.CONFIG_LOADER, data={"check50": True})[1]
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 73, in push
    username, commit_hash = upload(slug, user, tool, data)
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 354, in upload
    _run(git("commit -m {msg} --allow-empty", msg=commit_message))
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 704, in _run
    command_output = child.read().strip().replace("\r\n", "\n")
  File "/usr/local/lib/python3.9/contextlib.py", line 124, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.9/site-packages/lib50/_api.py", line 697, in _spawn
    raise Error()
lib50._errors.Error
Sorry, something is wrong! check50 ran into an error.
Please let CS50 know by emailing the error above to [email protected].

I've noticed your check50 output says generated by check50 v3.1.2 while the version on CS50 IDE is 3.2.0.

YalesRios avatar Feb 09 '21 17:02 YalesRios

@YalesRios I think the reason this is failing is because you have a branch in your me50/YalesRios repo called liv-ac-uk/comp108/2020-21 already, which is a prefix of liv-ac-uk/COMP108/2020-21/A1 and git doesn't allow branches to be prefixes of other branches. You can get around this by renaming either branch such that none of them is a prefix of any other branch or simply deleting the prefix branch.

I've gone ahead and renamed the branch for you to old/liv-ac-uk/COMP108/2020-21/A1, so I think you should be able to run check50 now without any issues.

@Jelleas thoughts on how to address this better? Maybe a better error message and offer to rename? Would that break anything?

kzidane avatar Feb 09 '21 18:02 kzidane

@kzidane agree, we can do better here. Would just need to check for a prefix-branch, and warn and exit. Anyway, this would live in lib50, so let me just open up an issue there and link this :)

Jelleas avatar Feb 09 '21 18:02 Jelleas