Skip to contentSkip to conversation

Change in openvpn[master]: platform.c: Do not depend Windows build on HAVE_CHDIR

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Nov 10, 2023 – Nov 11, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1699637918000.I0c78ce452135fe2c80275da449215ba926471018@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/425?usp=email

to review the following change.

Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

platform.c: Do not depend Windows build on HAVE_CHDIR

This broke in the CMake build since previously we just always set HAVE_CHDIR to 1 in the MSVC build. But actually the code should just not check HAVE_CHDIR on Windows.

Change-Id I0c78ce452135fe2c80275da449215ba926471018

---
M src/openvpn/platform.c

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/425/1

src/openvpn/platform.c +2 -2
index 32c4fe6..62acabe 100644
@@ -392,7 +392,6 @@
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Gerrit-Change-Number: 425
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/425?usp=email )

Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
Makes sense, we can assume that _wchdir always exists on Windows. We still have the broken detection of chdir, though - on Windows we need to search for chdir in direct.h.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Gerrit-Change-Number: 425
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 10 Nov 2023 17:53:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/425?usp=email )

Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
can we make this somewhat more radical, getting completely rid of HAVE_CHDIR across all files and platforms and autoconf/cmake config? There is no POSIX (or unix) platform without chdir()...

"HISTORY
The chdir() system call appeared in Version 1 AT&T UNIX."

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Gerrit-Change-Number: 425
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 10 Nov 2023 18:19:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw

PATCH 1/1 platform.c: Do not depend Windows build on HAVE_CHDIR

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

This broke in the CMake build since previously we just always set HAVE_CHDIR to 1 in the MSVC build. But actually the code should just not check HAVE_CHDIR on Windows.

Change-Id I0c78ce452135fe2c80275da449215ba926471018

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/425
This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>

src/openvpn/platform.c +2 -2
index 32c4fe6..62acabe 100644
@@ -392,7 +392,6 @@
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: platform.c: Do not depend Windows build on HAVE_CHDIR

This patch will do the job, but I think (at least for "master") we should do a bit more thorough job - as in, get rid of HAVE_CHDIR completely, in autoconf, cmake, header files. There is no platform where we have a remote chance in getting OpenVPN ported that has no chdir(), so this is all a nice excercise in achieving nothing.

I have not tested this beyond "does it compile?" but the change looks reasonable and Lev has ACKed it.

Your patch has been applied to the master and release/2.6 branch.

commit 012ea92c414282488e3d60c87452849bde64aac4 (master) commit b705517b12d14876a12593416a45756b7a952f1e (release/2.6)

Author: Frank Lichtenheld
Date:   Sat Nov 11 09:18:08 2023 +0100
     platform.c: Do not depend Windows build on HAVE_CHDIR

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg27362.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/425?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by stipa

Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

platform.c: Do not depend Windows build on HAVE_CHDIR

This broke in the CMake build since previously we just always set HAVE_CHDIR to 1 in the MSVC build. But actually the code should just not check HAVE_CHDIR on Windows.

Github: fixes OpenVPN/openvpn#448

Change-Id I0c78ce452135fe2c80275da449215ba926471018

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27362.html

---
M src/openvpn/platform.c

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/425/2

src/openvpn/platform.c +2 -2
index 32c4fe6..62acabe 100644
@@ -392,7 +392,6 @@
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Gerrit-Change-Number: 425
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/425?usp=email )

Change subject: platform.c: Do not depend Windows build on HAVE_CHDIR
......................................................................

platform.c: Do not depend Windows build on HAVE_CHDIR

This broke in the CMake build since previously we just always set HAVE_CHDIR to 1 in the MSVC build. But actually the code should just not check HAVE_CHDIR on Windows.

Github: fixes OpenVPN/openvpn#448

Change-Id I0c78ce452135fe2c80275da449215ba926471018

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27362.html

---
M src/openvpn/platform.c

1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/platform.c +2 -2
index 32c4fe6..62acabe 100644
@@ -392,7 +392,6 @@
 int
 platform_chdir(const char *dir)
 {
-#ifdef HAVE_CHDIR
 #ifdef _WIN32
     int res;
     struct gc_arena gc = gc_new();
@@ -400,11 +399,12 @@
     gc_free(&gc);
     return res;
 #else  /* ifdef _WIN32 */
+#ifdef HAVE_CHDIR
     return chdir(dir);
-#endif
 #else  /* ifdef HAVE_CHDIR */
     return -1;
 #endif
+#endif
 }
 
 /*

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c78ce452135fe2c80275da449215ba926471018
Gerrit-Change-Number: 425
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged