bt-cli 0.4.14__py3-none-any.whl → 0.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bt_cli/core/config_file.py +14 -3
- {bt_cli-0.4.14.dist-info → bt_cli-0.4.15.dist-info}/METADATA +1 -1
- {bt_cli-0.4.14.dist-info → bt_cli-0.4.15.dist-info}/RECORD +5 -5
- {bt_cli-0.4.14.dist-info → bt_cli-0.4.15.dist-info}/WHEEL +0 -0
- {bt_cli-0.4.14.dist-info → bt_cli-0.4.15.dist-info}/entry_points.txt +0 -0
bt_cli/core/config_file.py
CHANGED
|
@@ -205,6 +205,7 @@ def save_config_file(config: ConfigFile, path: Optional[Path] = None) -> None:
|
|
|
205
205
|
# This prevents TOCTOU race where file could be readable between
|
|
206
206
|
# creation and chmod.
|
|
207
207
|
import os
|
|
208
|
+
import sys
|
|
208
209
|
import tempfile
|
|
209
210
|
|
|
210
211
|
# Write to temp file in same directory, then atomic rename
|
|
@@ -213,12 +214,22 @@ def save_config_file(config: ConfigFile, path: Optional[Path] = None) -> None:
|
|
|
213
214
|
# Create temp file with secure permissions
|
|
214
215
|
fd, tmp_path = tempfile.mkstemp(dir=dir_path, prefix=".config_", suffix=".tmp")
|
|
215
216
|
try:
|
|
216
|
-
# Set permissions on file descriptor before writing
|
|
217
|
-
|
|
217
|
+
# Set permissions on file descriptor before writing (POSIX only)
|
|
218
|
+
# Windows doesn't support fchmod - permissions work differently there
|
|
219
|
+
if sys.platform != "win32" and hasattr(os, "fchmod"):
|
|
220
|
+
os.fchmod(fd, 0o600)
|
|
218
221
|
with os.fdopen(fd, "w") as f:
|
|
219
222
|
yaml.dump(data, f, default_flow_style=False, sort_keys=False)
|
|
220
|
-
# Atomic rename
|
|
223
|
+
# Atomic rename (on Windows, need to remove target first if exists)
|
|
224
|
+
if sys.platform == "win32" and path.exists():
|
|
225
|
+
os.unlink(path)
|
|
221
226
|
os.rename(tmp_path, path)
|
|
227
|
+
# On Windows, set permissions after the fact using chmod
|
|
228
|
+
if sys.platform == "win32":
|
|
229
|
+
try:
|
|
230
|
+
os.chmod(path, 0o600)
|
|
231
|
+
except OSError:
|
|
232
|
+
pass # Best effort on Windows
|
|
222
233
|
except Exception:
|
|
223
234
|
# Clean up temp file on error
|
|
224
235
|
try:
|
|
@@ -8,7 +8,7 @@ bt_cli/core/__init__.py,sha256=Yv_0gTKQcbEYNbNQ07YiK4sC8ueHktI-D20YlPWlT7g,49
|
|
|
8
8
|
bt_cli/core/auth.py,sha256=-vzGCgk2ZOsHExZBcxMHer68K3Bi0RMWF-17wtIZvsg,6723
|
|
9
9
|
bt_cli/core/client.py,sha256=pGxk5vI-U5_csiwBvMr_YwloOTmmWuFhX9TAA9ynoZw,8808
|
|
10
10
|
bt_cli/core/config.py,sha256=lQZgNH858HCIuizyDDFU0Bs1VbHjy3vaA2OthVgc7-w,13485
|
|
11
|
-
bt_cli/core/config_file.py,sha256=
|
|
11
|
+
bt_cli/core/config_file.py,sha256=k7yH-M53fEt9ahQBABWCcd9CBdfwjwGK20chNndF_UQ,13740
|
|
12
12
|
bt_cli/core/csv_utils.py,sha256=L7i-YGSeQV9RnzanKSQM1yvXgkmaQCpBoxUk9fV6RLg,2412
|
|
13
13
|
bt_cli/core/errors.py,sha256=-LWipqdn8w-FMAC1W1jFbTMAlooiJqmyuR5j1VWMPyM,8783
|
|
14
14
|
bt_cli/core/output.py,sha256=ACazDf3XAfJhAlns5fh6bQXkRIIGlBFuq1z2M-IBrwQ,5156
|
|
@@ -115,7 +115,7 @@ bt_cli/pws/models/account.py,sha256=OSCMyULPOH1Yu2WOzK0ZQhSRrggGpb2JPHScwGLqUgI,
|
|
|
115
115
|
bt_cli/pws/models/asset.py,sha256=Fl0AlR4_9Yyyu36FL1eKF29DNsxsB-r7FaOBRlfOg2Q,4081
|
|
116
116
|
bt_cli/pws/models/common.py,sha256=D9Ah4ob5CIiFhTt_IR9nF2cBWRHS2z9OyBR2Sss5yzw,3487
|
|
117
117
|
bt_cli/pws/models/system.py,sha256=D_J0x1A92H2n6BsaBEK9PSAAcs3BTifA5-M9SQqQFGA,5856
|
|
118
|
-
bt_cli-0.4.
|
|
119
|
-
bt_cli-0.4.
|
|
120
|
-
bt_cli-0.4.
|
|
121
|
-
bt_cli-0.4.
|
|
118
|
+
bt_cli-0.4.15.dist-info/METADATA,sha256=Y4PqMIcnmFA7NIVq4jwHvtiCz8olnpps9HaHoipijeQ,11803
|
|
119
|
+
bt_cli-0.4.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
120
|
+
bt_cli-0.4.15.dist-info/entry_points.txt,sha256=NCOEqTI-XKpJOux0JKKhbRElz0B7upayh_d99X5hoLs,38
|
|
121
|
+
bt_cli-0.4.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|