Skip to content
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

CalledProcessError git commit -F /tmp #202

Closed
aidiss opened this issue Jun 25, 2024 · 6 comments · Fixed by #203
Closed

CalledProcessError git commit -F /tmp #202

aidiss opened this issue Jun 25, 2024 · 6 comments · Fixed by #203
Labels
question Further information is requested

Comments

@aidiss
Copy link

aidiss commented Jun 25, 2024

  • bump-my-version version: 0.23.0
  • Python version: 3.10
  • Operating System: Linux

Description

Trying to bump version, with commit enabled.

Getting strange error message about git trying to commit some tmp file. No more info provided.

What I Did

$ bump-my-version bump $BUMP_TYPE --verbose
Starting BumpVersion 0.23.0                                                     
Reading configuration 
  
...

  Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128,   
output: b''      
  Committing to Git with message 'Bump version: 1.1.26 → 1.1.27'                
  Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128,   
output: b''                                                                     
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.10/site-packages/bumpversion/scm.py:74 in commit      │
│                                                                              │
│    71 │   │                                                                  │
│    72 │   │   try:                                                           │
│    73 │   │   │   cmd = [*cls._COMMIT_COMMAND, f.name, *extra_args]          │
│ ❱  74 │   │   │   subprocess.run(cmd, env=env, capture_output=True, check=Tr │
│    75 │   │   except (subprocess.CalledProcessError, TypeError) as exc:  # p │
│    76 │   │   │   if isinstance(exc, TypeError):                             │
│    77 │   │   │   │   err_msg = f"Failed to run {cls._COMMIT_COMMAND}: {exc} │
│                                                                              │
│ /usr/lib64/python3.10/subprocess.py:526 in run                               │
│                                                                              │
│    523 │   │   │   raise                                                     │
│    524 │   │   retcode = process.poll()                                      │
│    525 │   │   if check and retcode:                                         │
│ ❱  526 │   │   │   raise CalledProcessError(retcode, process.args,           │
│    527 │   │   │   │   │   │   │   │   │    output=stdout, stderr=stderr)    │
│    528 │   return CompletedProcess(process.args, retcode, stdout, stderr)    │
│    529                                                                       │
╰──────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['git', 'commit', '-F', '/tmp/tmpbl8vme_1']'       
returned non-zero exit status 128.                                              
                                                                                
 Usage: bump-my-version bump [OPTIONS] [ARGS]...                                
                                                                                
 Try 'bump-my-version bump -h' for help                                         
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128,  │
│ output: b''                                                                  │
╰──────────────────────────────────────────────────────────────────────────────╯

@coordt
Copy link
Member

coordt commented Jun 25, 2024

@aidiss Let me first thank you for providing such a complete error report! I'll look into it today.

@coordt coordt linked a pull request Jun 25, 2024 that will close this issue
@coordt coordt reopened this Jun 25, 2024
@coordt
Copy link
Member

coordt commented Jun 25, 2024

Version 0.24.0 improves the reporting of errors from git commands. Can you try this version? The underlying issue is from git, and is somewhat difficult to debug.

Let me know what the new results are.

@aidiss
Copy link
Author

aidiss commented Jun 25, 2024

Here is 0.24.0 error:

subprocess.CalledProcessError: Command '['git', 'commit', '-F', '/tmp/tmp6d4i_ucn']' returned non-zero exit status 128.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/bump-my-version", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/rich_click/rich_command.py", line 367, in __call__
    return super().__call__(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/rich_click/rich_command.py", line 152, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/bumpversion/cli.py", line 309, in bump
    do_bump(version_part, new_version, config, found_config_file, dry_run)
  File "/usr/local/lib/python3.10/site-packages/bumpversion/bump.py", line 112, in do_bump
    commit_and_tag(config, config_file, configured_files, ctx, dry_run)
  File "/usr/local/lib/python3.10/site-packages/bumpversion/bump.py", line 142, in commit_and_tag
    config.scm_info.tool.commit_to_scm(list(commit_files), config, ctx, extra_args, dry_run)
  File "/usr/local/lib/python3.10/site-packages/bumpversion/scm.py", line 179, in commit_to_scm
    cls.commit(
  File "/usr/local/lib/python3.10/site-packages/bumpversion/scm.py", line 79, in commit
    output = "\n".join([x for x in [exc.stdout, exc.stderr] if x])
TypeError: sequence item 0: expected str instance, bytes found

@coordt
Copy link
Member

coordt commented Jun 26, 2024

SIGH Work too fast and make stupid mistakes. 0.24.1 has a test for and fixes that error. Try again with 0.24.1

@coordt
Copy link
Member

coordt commented Jun 28, 2024

@aidiss Just checking in to see if you have tried it again with 0.24.1?

@coordt coordt added the question Further information is requested label Jul 4, 2024
@aidiss
Copy link
Author

aidiss commented Jul 29, 2024

The issue was not having git user and email configured.
Now error message got transparante and is working fine.
Thank you!

@aidiss aidiss closed this as completed Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants