fix(db-*): на POSIX снимать обрамляющие кавычки с аргументов платформы

Воспроизведено на darwin: db-load-xml с путём, содержащим пробел, падает с
«Неопределена информационная база». На POSIX аргументы уходят списком, и
кавычки, нужные для склейки команды на Windows, становятся частью значения.
Тот же механизм ранее молча терял многословный -comment в db-repo.

Правка в общей run_v8 (семья platform: run_v8) — чинит все двенадцать
потребителей разом. Снимается ОДИН слой обрамляющих кавычек, поэтому склеенные
ключи (/N"user", File="…", /ConfigurationRepositoryF"путь") не задеты: у них
кавычки внутри токена, там их ждёт разборщик 1С.

PS1 не затронут: там команда всегда склеивается в строку. Точечный arg_value(),
добавленный в db-repo при разборе дефекта, откачен — семейная правка делает его
лишним.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-08-23 15:42:46 +03:00
co-authored by Claude Opus 5
parent ab5c1fd7c1
commit b7837c86ce
12 changed files with 148 additions and 54 deletions
+11 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-create v1.12 — Create 1C information base # db-create v1.13 — Create 1C information base
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -332,11 +332,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-dump-cf v1.14 — Dump 1C configuration to CF file # db-dump-cf v1.15 — Dump 1C configuration to CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-dump-dt v1.13 — Dump 1C information base to DT file # db-dump-dt v1.14 — Dump 1C information base to DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-dump-xml v1.18 — Dump 1C configuration to XML files # db-dump-xml v1.19 — Dump 1C configuration to XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -404,11 +404,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-load-cf v1.15 — Load 1C configuration from CF file # db-load-cf v1.16 — Load 1C configuration from CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-load-dt v1.14 — Load 1C information base from DT file # db-load-dt v1.15 — Load 1C information base from DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-load-git v1.24 — Load Git changes into 1C database # db-load-git v1.25 — Load Git changes into 1C database
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -425,11 +425,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-load-xml v1.25 — Load 1C configuration from XML files # db-load-xml v1.26 — Load 1C configuration from XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -425,11 +425,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
+27 -32
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-repo v1.11 — 1C configuration repository operations # db-repo v1.12 — 1C configuration repository operations
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима). # NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима).
"""Работа с хранилищем конфигурации 1С. """Работа с хранилищем конфигурации 1С.
@@ -290,11 +290,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
@@ -673,20 +682,6 @@ COMMAND_ALIASES = {
} }
def arg_value(value):
"""Значение отдельного аргумента.
На Windows команда склеивается в одну строку (см. run_v8), поэтому значение с пробелом
обязано нести собственные кавычки. На POSIX аргументы уходят списком — там кавычки стали бы
ЧАСТЬЮ значения. Проверено на darwin: многословный -comment с кавычками платформа теряет
целиком, однословный без кавычек доходит.
Ключи вида /F"путь" и /N"имя" собираются отдельно: там кавычки внутри токена требует сам
разборщик 1С, и они нужны на обеих ОС.
"""
return '"%s"' % value if os.name == "nt" else "%s" % value
def resolve_command(raw): def resolve_command(raw):
c = raw.strip().lower() c = raw.strip().lower()
# unbind отличается от unlock одной буквой, а последствия разные: отмена захвата против # unbind отличается от unlock одной буквой, а последствия разные: отмена захвата против
@@ -1049,9 +1044,9 @@ def main():
# --- Соединение --- # --- Соединение ---
arguments = ["DESIGNER"] arguments = ["DESIGNER"]
if args.InfoBaseServer and args.InfoBaseRef: if args.InfoBaseServer and args.InfoBaseRef:
arguments += ["/S", arg_value("%s/%s" % (args.InfoBaseServer, args.InfoBaseRef))] arguments += ["/S", '"%s/%s"' % (args.InfoBaseServer, args.InfoBaseRef)]
else: else:
arguments += ["/F", arg_value(args.InfoBasePath)] arguments += ["/F", '"%s"' % args.InfoBasePath]
if args.UserName: if args.UserName:
arguments.append('/N"%s"' % args.UserName) arguments.append('/N"%s"' % args.UserName)
if args.Password: if args.Password:
@@ -1067,12 +1062,12 @@ def main():
arguments.append(key) arguments.append(key)
if cmd in ("dump-cfg", "report"): if cmd in ("dump-cfg", "report"):
arguments.append(arg_value(args.OutputFile)) arguments.append('"%s"' % args.OutputFile)
if cmd in object_aware and requested: if cmd in object_aware and requested:
objects_xml = write_objects_list_xml( objects_xml = write_objects_list_xml(
requested, os.path.join(temp_dir, "objects.xml"), args.WithChildren) requested, os.path.join(temp_dir, "objects.xml"), args.WithChildren)
arguments += ["-Objects", arg_value(objects_xml)] arguments += ["-Objects", '"%s"' % objects_xml]
if cmd == "lock": if cmd == "lock":
if args.Revised: if args.Revised:
@@ -1084,7 +1079,7 @@ def main():
if args.Comment: if args.Comment:
# Многострочный комментарий задаётся своим -comment на каждую строку. # Многострочный комментарий задаётся своим -comment на каждую строку.
for line in args.Comment.splitlines(): for line in args.Comment.splitlines():
arguments += ["-comment", arg_value(line)] arguments += ["-comment", '"%s"' % line]
if args.KeepLocked: if args.KeepLocked:
arguments.append("-keepLocked") arguments.append("-keepLocked")
if args.Force: if args.Force:
@@ -1113,9 +1108,9 @@ def main():
if args.NEnd: if args.NEnd:
arguments += ["-NEnd", args.NEnd] arguments += ["-NEnd", args.NEnd]
if args.DateBegin: if args.DateBegin:
arguments += ["-DateBegin", arg_value(args.DateBegin)] arguments += ["-DateBegin", '"%s"' % args.DateBegin]
if args.DateEnd: if args.DateEnd:
arguments += ["-DateEnd", arg_value(args.DateEnd)] arguments += ["-DateEnd", '"%s"' % args.DateEnd]
if args.GroupByObject: if args.GroupByObject:
arguments.append("-GroupByObject") arguments.append("-GroupByObject")
if args.GroupByComment: if args.GroupByComment:
@@ -1131,32 +1126,32 @@ def main():
if args.NoBind: if args.NoBind:
arguments.append("-NoBind") arguments.append("-NoBind")
elif cmd == "add-user": elif cmd == "add-user":
arguments += ["-User", arg_value(args.NewUser)] arguments += ["-User", '"%s"' % args.NewUser]
if args.NewUserPassword: if args.NewUserPassword:
arguments += ["-Pwd", arg_value(args.NewUserPassword)] arguments += ["-Pwd", '"%s"' % args.NewUserPassword]
arguments += ["-Rights", args.Rights] arguments += ["-Rights", args.Rights]
if args.RestoreDeletedUser: if args.RestoreDeletedUser:
arguments.append("-RestoreDeletedUser") arguments.append("-RestoreDeletedUser")
elif cmd == "copy-users": elif cmd == "copy-users":
arguments += ["-Path", arg_value(args.SourcePath)] arguments += ["-Path", '"%s"' % args.SourcePath]
arguments += ["-User", arg_value(args.SourceUser)] arguments += ["-User", '"%s"' % args.SourceUser]
if args.SourcePassword: if args.SourcePassword:
arguments += ["-Pwd", arg_value(args.SourcePassword)] arguments += ["-Pwd", '"%s"' % args.SourcePassword]
if args.RestoreDeletedUser: if args.RestoreDeletedUser:
arguments.append("-RestoreDeletedUser") arguments.append("-RestoreDeletedUser")
elif cmd == "set-label": elif cmd == "set-label":
if args.Version: if args.Version:
arguments += ["-v", args.Version] arguments += ["-v", args.Version]
arguments += ["-name", arg_value(args.Label)] arguments += ["-name", '"%s"' % args.Label]
if args.Comment: if args.Comment:
for line in args.Comment.splitlines(): for line in args.Comment.splitlines():
arguments += ["-comment", arg_value(line)] arguments += ["-comment", '"%s"' % line]
if args.Extension: if args.Extension:
arguments += ["-Extension", arg_value(args.Extension)] arguments += ["-Extension", '"%s"' % args.Extension]
log_file = os.path.join(temp_dir, "repo_log.txt") log_file = os.path.join(temp_dir, "repo_log.txt")
arguments += ["/Out", arg_value(log_file)] arguments += ["/Out", '"%s"' % log_file]
arguments.append("/DisableStartupDialogs") arguments.append("/DisableStartupDialogs")
arguments.append("/DisableStartupMessages") arguments.append("/DisableStartupMessages")
arguments += extra_args arguments += extra_args
+11 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# db-update v1.17 — Update 1C database configuration # db-update v1.18 — Update 1C database configuration
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -404,11 +404,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
+11 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# epf-build v1.14 — Build external data processor or report (EPF/ERF) from XML sources # epf-build v1.15 — Build external data processor or report (EPF/ERF) from XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)
+11 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# epf-dump v1.13 — Dump external data processor or report (EPF/ERF) to XML sources # epf-dump v1.14 — Dump external data processor or report (EPF/ERF) to XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse import argparse
@@ -319,11 +319,20 @@ def run_v8(v8path, arguments):
The arguments carry their own quotes inside the value (File="C:\\a b") — that is where The arguments carry their own quotes inside the value (File="C:\\a b") — that is where
1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would 1C's parser expects them, on Windows and on *nix alike. Windows list2cmdline would
escape those quotes, so there the command line is handed over ready-made. escape those quotes, so there the command line is handed over ready-made.
На POSIX аргументы уходят СПИСКОМ, и кавычки, нужные для склейки на Windows, стали бы
частью значения: путь с пробелом платформа не находит («Неопределена информационная
база»), многословный -comment теряет молча. Поэтому здесь снимается ОДИН слой
обрамляющих кавычек. Склеенные ключи (/N"user", /ConfigurationRepositoryF"путь",
File="") не задеты: у них кавычки внутри токена, а не по краям.
""" """
if os.name == "nt": if os.name == "nt":
cmd = '"' + v8path + '" ' + " ".join(arguments) cmd = '"' + v8path + '" ' + " ".join(arguments)
else: else:
cmd = [v8path] + arguments cmd = [v8path] + [
a[1:-1] if len(a) > 1 and a[0] == '"' and a[-1] == '"' else a
for a in arguments
]
r = subprocess.run(cmd, input=b"", capture_output=True) r = subprocess.run(cmd, input=b"", capture_output=True)
r.stdout = decode_platform_bytes(r.stdout) r.stdout = decode_platform_bytes(r.stdout)
r.stderr = decode_platform_bytes(r.stderr) r.stderr = decode_platform_bytes(r.stderr)