New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] make win32_link and win32_rename raise ENOSPC and EDQUOT when appropriate #13281
Comments
From cm.perl@abtela.comCreated by cm.perl@abtela.comThe attached patch refines the mapping of windows error codes to POSIX For win32_rename, I raised and tested ERROR_DISK_FULL (resp. For win32_link, I raised and tested ERROR_DISK_FULL by attempting to I can't think of a way to incorporate similar tests in the distribution. FWIW, I run into these errors with win32_rename quite frequently. The IMO this corrects a longstanding oversight, and as such should be Christian. Perl Info
|
From cm.perl@abtela.com0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patchFrom 0199bbc1b113b197637c9c301f10b028faf2bf4d Mon Sep 17 00:00:00 2001
From: Christian Millour <cm.perl@abtela.com>
Date: Tue, 17 Sep 2013 00:56:24 +0200
Subject: [PATCH] make win32_link and win32_rename raise ENOSPC and EDQUOT when appropriate
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4"
This is a multi-part message in MIME format.
--------------1.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
win32/win32.c | 49 ++++++++++++++-----------------------------------
1 files changed, 14 insertions(+), 35 deletions(-)
--------------1.7.4
Content-Type: text/x-patch; name="0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patch"
diff --git a/win32/win32.c b/win32/win32.c
index 9f996d6..1de804f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2513,7 +2513,7 @@ win32_flock(int fd, int oper)
}
if (i == -1) {
if (GetLastError() == ERROR_LOCK_VIOLATION)
- errno = EWOULDBLOCK;
+ errno = WSAEWOULDBLOCK;
else
errno = EINVAL;
}
@@ -2522,21 +2522,6 @@ win32_flock(int fd, int oper)
#undef LK_LEN
-extern int convert_wsa_error_to_errno(int wsaerr); /* in win32sck.c */
-
-/* Get the errno value corresponding to the given err. This function is not
- * intended to handle conversion of general GetLastError() codes. It only exists
- * to translate Windows sockets error codes from WSAGetLastError(). Such codes
- * used to be assigned to errno/$! in earlier versions of perl; this function is
- * used to catch any old Perl code which is still trying to assign such values
- * to $! and convert them to errno values instead.
- */
-int
-win32_get_errno(int err)
-{
- return convert_wsa_error_to_errno(err);
-}
-
/*
* redirected io subsystem for all XS modules
*
@@ -2586,16 +2571,10 @@ win32_feof(FILE *fp)
return (feof(fp));
}
-#ifdef ERRNO_HAS_POSIX_SUPPLEMENT
-extern int convert_errno_to_wsa_error(int err); /* in win32sck.c */
-#endif
-
/*
* Since the errors returned by the socket error function
* WSAGetLastError() are not known by the library routine strerror
- * we have to roll our own to cover the case of socket errors
- * that could not be converted to regular errno values by
- * get_last_socket_error() in win32/win32sck.c.
+ * we have to roll our own.
*/
DllExport char *
@@ -2609,18 +2588,6 @@ win32_strerror(int e)
dTHXa(NULL);
if (e < 0)
e = GetLastError();
-#ifdef ERRNO_HAS_POSIX_SUPPLEMENT
- /* VC10+ define a "POSIX supplement" of errno values ranging from
- * EADDRINUSE (100) to EWOULDBLOCK (140), but sys_nerr is still 43 and
- * strerror() returns "Unknown error" for them. We must therefore still
- * roll our own messages for these codes, and additionally map them to
- * corresponding Windows (sockets) error codes first to avoid getting
- * the wrong system message.
- */
- else if (e >= EADDRINUSE && e <= EWOULDBLOCK) {
- e = convert_errno_to_wsa_error(e);
- }
-#endif
aTHXa(PERL_GET_THX);
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
@@ -3138,6 +3105,12 @@ win32_link(const char *oldname, const char *newname)
case ERROR_NOT_SAME_DEVICE:
errno = EXDEV;
break;
+ case ERROR_DISK_FULL:
+ errno = ENOSPC;
+ break;
+ case ERROR_NOT_ENOUGH_QUOTA:
+ errno = EDQUOT;
+ break;
default:
/* ERROR_INVALID_FUNCTION - eg. on a FAT volume */
errno = EINVAL;
@@ -3172,6 +3145,12 @@ win32_rename(const char *oname, const char *newname)
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
+ case ERROR_DISK_FULL:
+ errno = ENOSPC;
+ break;
+ case ERROR_NOT_ENOUGH_QUOTA:
+ errno = EDQUOT;
+ break;
default:
errno = EACCES;
break;
--------------1.7.4--
|
From cm.perl@abtela.comDamn. I was so struggling with composing this ticket on windows that I Sorry for the noise. Christian. Le 17/09/2013 01:28, Christian Millour a écrit :
|
From cm.perl@abtela.com0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patchFrom 92cd18ac25b792129845e61960a6dc2d25070e06 Mon Sep 17 00:00:00 2001
From: Christian Millour <cm.perl@abtela.com>
Date: Tue, 17 Sep 2013 01:52:26 +0200
Subject: [PATCH] make win32_link and win32_rename raise ENOSPC and EDQUOT when appropriate
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4"
This is a multi-part message in MIME format.
--------------1.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
win32/win32.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
--------------1.7.4
Content-Type: text/x-patch; name="0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-make-win32_link-and-win32_rename-raise-ENOSPC-and-ED.patch"
diff --git a/win32/win32.c b/win32/win32.c
index 9f996d6..5322881 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3138,6 +3138,12 @@ win32_link(const char *oldname, const char *newname)
case ERROR_NOT_SAME_DEVICE:
errno = EXDEV;
break;
+ case ERROR_DISK_FULL:
+ errno = ENOSPC;
+ break;
+ case ERROR_NOT_ENOUGH_QUOTA:
+ errno = EDQUOT;
+ break;
default:
/* ERROR_INVALID_FUNCTION - eg. on a FAT volume */
errno = EINVAL;
@@ -3172,6 +3178,12 @@ win32_rename(const char *oname, const char *newname)
case ERROR_PATH_NOT_FOUND:
errno = ENOENT;
break;
+ case ERROR_DISK_FULL:
+ errno = ENOSPC;
+ break;
+ case ERROR_NOT_ENOUGH_QUOTA:
+ errno = EDQUOT;
+ break;
default:
errno = EACCES;
break;
--------------1.7.4--
|
From @tonycozOn Mon Sep 16 16:58:25 2013, cm.perl@abtela.com wrote:
Applied as e41416c with an AUTHORS
Neither can I.
I don't believe this change qualifies for maint, see MAINTENANCE Tony |
The RT System itself - Status changed from 'new' to 'open' |
From cm.perl@abtela.comLe 17/09/2013 07:51, Tony Cook via RT a écrit : Thank you.
Thank you for this pointer. The corresponding section in perlhack had Inline Patchdiff --git a/pod/perlhack.pod b/pod/perlhack.pod
index ff685d2..8c576c4 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -236,7 +236,8 @@ volunteers, and be polite.
Changes are always applied directly to the main development branch,
called "blead". Some patches may be backported to a maintenance
branch. If you think your patch is appropriate for the maintenance
-branch, please explain why when you submit it.
+branch (see MAINTENANCE BRANCHES in perlpolicy), please explain why
+when you submit it.
=head2 Getting your patch accepted
Please find also attached a perldelta entry for the topic patch. Christian. |
From cm.perl@abtela.com0001-add-reference-to-maintenance-branches-in-perlpolicy.patchFrom 9da0c2f4ffebf4dceae2063c8113a664b74de298 Mon Sep 17 00:00:00 2001
From: Christian Millour <cm.perl@abtela.com>
Date: Tue, 17 Sep 2013 08:17:19 +0200
Subject: [PATCH] add reference to maintenance branches in perlpolicy
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4"
This is a multi-part message in MIME format.
--------------1.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
pod/perlhack.pod | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
--------------1.7.4
Content-Type: text/x-patch; name="0001-add-reference-to-maintenance-branches-in-perlpolicy.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-add-reference-to-maintenance-branches-in-perlpolicy.patch"
diff --git a/pod/perlhack.pod b/pod/perlhack.pod
index ff685d2..8c576c4 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -236,7 +236,8 @@ volunteers, and be polite.
Changes are always applied directly to the main development branch,
called "blead". Some patches may be backported to a maintenance
branch. If you think your patch is appropriate for the maintenance
-branch, please explain why when you submit it.
+branch (see MAINTENANCE BRANCHES in perlpolicy), please explain why
+when you submit it.
=head2 Getting your patch accepted
--------------1.7.4--
|
From cm.perl@abtela.com0001-perldelta-for-119857.patchFrom a2095b1eee29ae478aaa443bed8bb5dfcb33f4b2 Mon Sep 17 00:00:00 2001
From: Christian Millour <cm.perl@abtela.com>
Date: Tue, 17 Sep 2013 09:21:22 +0200
Subject: [PATCH] perldelta for #119857
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.4"
This is a multi-part message in MIME format.
--------------1.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
pod/perldelta.pod | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
--------------1.7.4
Content-Type: text/x-patch; name="0001-perldelta-for-119857.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-perldelta-for-119857.patch"
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 72fd668..e303bb4 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -940,6 +940,16 @@ L</Modules and Pragmata> section.
=over 4
+=head3 Win32
+
+=over
+
+=item *
+
+C<rename> and C<link> on Win32 now set C<$!> to ENOSPC and EDQUOT when appropriate. [perl #119857]
+
+=back
+
=item WinCE
The building of XS modules has largely been restored. Several still cannot
--------------1.7.4--
|
From @steve-m-hay
Thanks, both patches applied in commits d0bba22 and ff3b140. |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#119857 (status was 'resolved')
Searchable as RT119857$
The text was updated successfully, but these errors were encountered: