darkoperator / darkoperator/Posh-SSH

Set-SCPItem for a directory does not support unregular characters

Open
#535 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Trying to send a whole directory using Set-SCPItem that contains unregluar characters in its name leads to what seems like a locked terminal and nothing happens. I haven't investigated this deeply (maybe the same goes for regular files as well) but a command like this:

>> Set-SCPItem -ComputerName computername -Path .\Folder(Name)\ -Destination /Upload/ -Verbose

VERBOSE: Using SSH Username and Password authentication for connection.
VERBOSE: ssh-ed25519 Fingerprint for computername: <...mac-adress-or-something>
VERBOSE: Fingerprint matched trusted ssh-ed25519 fingerprint for host computername
VERBOSE: Connection successful
VERBOSE: Uploading: C:\Users\User\Folder(Name)\
VERBOSE: Destination: /MUSIC/Interplay/Folder(Name)

This will just hang forever (at least over night 😅) and cant be interupted with ctrl+c. I'm gussing it has to do with some path-parsing on the destination side as ( needs to be escaped 🤔 ( on a *unix machine

As a sidenote; if one tries to send a directory, and a directory with the same name doesn't exist on the Destination, one would get a

>> Set-SCPItem -ComputerName computername -Path .\SomeDir\ -Destination /Upload/ -Verbose
(...)
Set-SCPItem: scp: /Upload/SomeDir: No such file or directory

Which is a little counter-intuitive when one tries to send a complete directory, but not a huge problem. Just annoyance 😇

 >>  Get-Module Posh-SSH

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   3.0.8                 Posh-SSH                            {Get-SCPItem, Get-SFTPItem, Get-SSHHostKey, Get-SSHJsonKnownHost…}`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Set-SCPItem command with a directory named Folder(Name), then trace the Set-SCPItem path handling and SCP invocation used for directory uploads. Compare this with a directory whose name contains only regular characters and verify that the transfer completes, can be interrupted normally, and reports a clear result when the destination directory is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.