canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.18k stars 446 forks source link

SSH key password prompt doesn't appear when cloning repositories #4578

Open dilyn-corner opened 9 months ago

dilyn-corner commented 9 months ago

Bug Description

Sometimes when pulling a part which may use SSH authentication to allow e.g. cloning a Git repository, the prompt to enter your SSH key's password to unlock it for authenticating doesn't appear and instead users see an endless Pulling <part> :: ... | (xy.zs).

Note that this has only been observed to happen when --verbosity=brief or higher - I imagine this is related to a "recent" rework of how the command line printing functioned. The password prompt will appear for longer when using brief before disappearing; the prompt will persist for a good long while when using quiet.

To Reproduce

Use an SSH key with a passphrase.

snapcraft --use-lxd --bind-ssh --verbosity=verbose During the pull step enter the password to your SSH key and press enter, watch the build progress. Repeat twice and the build should succeed (vacuously, nil part).

Environment

Observed with snapcraft revision 10607, though this has been seen on earlier revisions.

snapcraft.yaml

name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  matterhorn:
    plugin: nil
    source: https://github.com/matterhorn-chat/matterhorn
    source-depth: 1
    source-type: git
    source-branch: 90000.0.0

Relevant log output

dilyn@Ares:~/work/snaps/matterhorn-snap -> snapcraft --debug
# note this message -- it's strange, so I retry with --bind-ssh
The authenticity of host 'github.com (140.82.112.3)' can't be established.                                                                                     
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Pulling matterhorn :: + craftctl default \ (199.2s)                                                                                                            !
Pulling matterhorn :: + craftctl default | (216.6s)                                                                                                            ^Interrupted.                                                                                                                                                                                                                                                                                                  
Full execution log: '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240213-222425.980668.log'                                                              

dilyn@Ares:~/work/snaps/matterhorn-snap -> snapcraft --debug --bind-ssh               
Pulling matterhorn :: + craftctl default - (174.3s)                                                                                                            
Pulling matterhorn :: + craftctl default \ (178.4s)                                                                                                            
Pulling matterhorn :: + craftctl default | (182.1s)                                                                                                            
Pulling matterhorn :: Downloading the latest package list from hackage.haskell.org - (6.8s)   

Note the three instances of "Pulling ..." -- these appear because I hit . The prompt for my SSH key password briefly flashed on the line before being overwritten by this "Pulling ..." message. When I entered my passphrase, the pull progressed. It happens thrice because the example repository has two submodules which are also cloned.

Also strangely, doing this made it so that no new lines were printed and instead the last line was perpetually overwritten with any new information which would normally be added as a new line. For instance, the next few lines are what appear:

'override-pull' in part 'matterhorn' failed with code 1.                                                                                                       
Review the scriptlet and make sure it's correct.                                                      
Launching shell on build environment...    

As the build progressed but eventually errored due to something unrelated to this bug.



### Additional context

_No response_
syncronize-issues-to-jira[bot] commented 9 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2496.

This message was autogenerated