Martin Weinelt 2024-08-29 06:32:19 +02:00
parent 24699e786c
commit 132814bc5a
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 5 additions and 59 deletions

View File

@ -51,13 +51,13 @@ let
};
pname = "pretix";
version = "2024.7.1";
version = "2024.8.0";
src = fetchFromGitHub {
owner = "pretix";
repo = "pretix";
rev = "refs/tags/v${version}";
hash = "sha256-lOcV3+CNGyKR0QiQXr/hP/9rhWauEvnSLOvxmQa/DSg=";
hash = "sha256-3flZoDzS3SI7nAi1skEqVPXJM9vSBrGN+F0esbYKQDw=";
};
npmDeps = buildNpmPackage {
@ -65,7 +65,7 @@ let
inherit version src;
sourceRoot = "${src.name}/src/pretix/static/npm_dir";
npmDepsHash = "sha256-BfvKuwB5VLX09Lxji+EpMBvZeKTIQvptVtrHSRYY+14=";
npmDepsHash = "sha256-ZS+80LLyS2UBnVGRclYhwVwF1BR17D/79F2moQtqh80=";
dontBuild = true;
@ -87,17 +87,15 @@ python.pkgs.buildPythonApplication rec {
# Discover pretix.plugin entrypoints during build and add them into
# INSTALLED_APPS, so that their static files are collected.
./plugin-build.patch
# https://github.com/pretix/pretix/pull/4362
# Fix TOCTOU race in directory creation
./pr4362.patch
];
pythonRelaxDeps = [
"importlib-metadata"
"kombu"
"markdown"
"pillow"
"protobuf"
"pyjwt"
"python-bidi"
"requests"
"sentry-sdk"
@ -140,7 +138,6 @@ python.pkgs.buildPythonApplication rec {
cryptography
css-inline
defusedcsv
dj-static
django
django-bootstrap3
django-compressor
@ -199,7 +196,6 @@ python.pkgs.buildPythonApplication rec {
sentry-sdk
sepaxml
slimit
static3
stripe
text-unidecode
tlds

View File

@ -1,50 +0,0 @@
From 5688f3624005d02803f2a434db025f367b4963d3 Mon Sep 17 00:00:00 2001
From: Martin Weinelt <hexa@darmstadt.ccc.de>
Date: Thu, 1 Aug 2024 02:39:59 +0200
Subject: [PATCH] Prevent race condition in directory creation
Checking whether a path does not exist before trying to create it does
not follow the Python paradigm of asking for forgiveness, rather than
permission, and opens up a time-of-check to time-of-use race.
---
src/pretix/settings.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/pretix/settings.py b/src/pretix/settings.py
index 81ff644be..854187f05 100644
--- a/src/pretix/settings.py
+++ b/src/pretix/settings.py
@@ -37,6 +37,7 @@ import configparser
import logging
import os
import sys
+from contextlib import suppress
from json import loads
from urllib.parse import urlparse
@@ -70,14 +71,14 @@ MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
PROFILE_DIR = os.path.join(DATA_DIR, 'profiles')
CACHE_DIR = config.get('pretix', 'cachedir', fallback=os.path.join(DATA_DIR, 'cache'))
-if not os.path.exists(DATA_DIR):
- os.mkdir(DATA_DIR)
-if not os.path.exists(LOG_DIR):
- os.mkdir(LOG_DIR)
-if not os.path.exists(MEDIA_ROOT):
- os.mkdir(MEDIA_ROOT)
-if not os.path.exists(CACHE_DIR):
- os.mkdir(CACHE_DIR)
+def mkdir(path):
+ with suppress(FileExistsError):
+ os.mkdir(path)
+
+mkdir(DATA_DIR)
+mkdir(LOG_DIR)
+mkdir(MEDIA_ROOT)
+mkdir(CACHE_DIR)
if config.has_option('django', 'secret'):
SECRET_KEY = config.get('django', 'secret')
--
2.45.2