Dear Michael,

> You could also validate that using the CI, assuming that you have a
> cloned repo on github with the CI enabled.  See src/tools/ci/README.
> I use that a lot with local branches for pre-commit validations where
> things could break across the board.

I have run the tests on my CI and found that windows cannot accept the test.
Per attached output, starting the postgres with the single-user mode was failed
because the user had admin permissions [1]. However, pg_ctl start command could 
be
done by the same user.
I'm not familiar with Windows, but according to your blogpost [2], Windows seems
to allows running some server command by generating the restricted context for
running postgres commands. In case of single-user mode, however, we directly run
the given command with the current user. So, there is a possibility that only
instance can boot only by pg_ctl.
Based on that, I want to skip the test on windows platform rather than modifying
the ci environment.

IIUC, other tests which uses --single cannot work on windows as well.

> Hmm.  src/test/modules/test_misc/ makes more sense to me here.  (No
> need to send an updated patch just for that.)

I did not notice the directory and looked nice. Updated.

[1]:
```
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
```

[2]: https://paquier.xyz/postgresql-2/postgres-utilities-restricted-token/

Best regards,
Hayato Kuroda
FUJITSU LIMITED

# Checking port 16164
# Found port 16164
Name: node
Data directory: 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
Backup directory: 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/backup
Archive directory: 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/archives
Connection string: port=16164 host=C:/Windows/TEMP/HeMvBnwWt9
Log file: 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\log/049_slots_in_single_user_mode_node.log
[10:27:12.345](0.217s) # initializing database system by copying initdb template
# Running: robocopy /E /NJS /NJH /NFL /NDL /NP 
C:/cirrus/build/tmp_install/initdb-template 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata

# Running: C:\cirrus\build\src/test\regress\pg_regress.exe --config-auth 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
### Starting node "node"
# Running: pg_ctl --wait --pgdata 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 --log 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\log/049_slots_in_single_user_mode_node.log
 --options --cluster-name=node start
waiting for server to start.... done
server started
# Postmaster PID for node "node" is 2660
### Stopping node "node" using mode fast
# Running: pg_ctl --pgdata 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 --mode fast stop
waiting for server to shut down.... done
server stopped
# No postmaster PID for node "node"
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
[10:27:18.865](6.520s) ok 1 - replication slot cannot be created in single-user 
mode
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
[10:27:18.927](0.062s) ok 2 - logical decoding cannot be done in single-user 
mode
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
[10:27:19.114](0.187s) ok 3 - replication slot cannot be advanced in 
single-user mode
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
[10:27:19.285](0.171s) ok 4 - replication slot cannot be copied in single-user 
mode
# Running: postgres --single -F -c exit_on_error=true -D 
C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata
 postgres
Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
[10:27:19.413](0.128s) not ok 5 - replication slot can be dropped in 
single-user mode
[10:27:19.413](0.000s) #   Failed test 'replication slot can be dropped in 
single-user mode'
#   at C:/cirrus/src/test/recovery/t/049_slots_in_single_user_mode.pl line 35.
[10:27:19.414](0.000s) 1..5
[10:27:19.429](0.016s) # Looks like you failed 1 test of 5.

Attachment: v7-0001-Set-ReplicationSlot-active_pid-even-in-single-use.patch
Description: v7-0001-Set-ReplicationSlot-active_pid-even-in-single-use.patch

Attachment: v7-0002-Prohibit-slot-manipulation-while-in-single-user-m.patch
Description: v7-0002-Prohibit-slot-manipulation-while-in-single-user-m.patch

Reply via email to