aports/testing/py3-openssh-wrapper/replace-pipes.patch
mio 2e0e11e416 testing/py3-openssh-wrapper: rebuild against python 3.14
Fix `ModuleNotFoundError: No module named 'pipes'` error with python
3.14.

Ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/18025
2026-04-03 04:23:30 +00:00

46 lines
1.5 KiB
Diff

Patch-Source: https://github.com/proxmoxer/openssh-wrapper/commit/080d1143f490155684d15da91745f51c1108045f
Upstream issue: https://github.com/NetAngels/openssh-wrapper/issues/20
---
From 080d1143f490155684d15da91745f51c1108045f Mon Sep 17 00:00:00 2001
From: John Hollowell <jhollowe@johnhollowell.com>
Date: Tue, 10 Dec 2024 23:03:57 -0500
Subject: [PATCH] Replace `pipes` with `shlex`
---
openssh_wrapper.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/openssh_wrapper.py b/openssh_wrapper.py
index 741da66..0a3375b 100644
--- a/openssh_wrapper.py
+++ b/openssh_wrapper.py
@@ -6,7 +6,7 @@
import re
import os
import sys
-import pipes
+import shlex
import signal
import shutil
import getpass
@@ -61,8 +61,8 @@ def b_quote(cmd_chunks):
"""
quoted = []
for chunk in cmd_chunks:
- # pipes.quote works with text representation only
- quoted.append(b(pipes.quote(u(chunk))))
+ # shlex.quote works with text representation only
+ quoted.append(b(shlex.quote(u(chunk))))
return b(' ').join(quoted)
@@ -318,7 +318,7 @@ def get_scp_targets(self, filenames, target):
>>> get_scp_targets(['foo.txt', ], '/etc/passwd')
['/etc/passwd']
"""
- result = self.run(b('test -d %s' % pipes.quote(u(target))))
+ result = self.run(b('test -d %s' % shlex.quote(u(target))))
is_directory = result.returncode == 0
if is_directory:
ret = []