From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Ki=C3=AAn_?= =?UTF-8?Q?Nguy=E1=BB=85n?= Quang Newsgroups: gmane.emacs.bugs Subject: bug#57386: 29.0.50; support make-symbolic-link without admin priviledge on Windows Date: Thu, 25 Aug 2022 03:05:37 +0900 Message-ID: References: <838rnd638m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000fc94c605e700875e" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22645"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57386@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 24 20:06:34 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQulu-0005k7-CS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Aug 2022 20:06:34 +0200 Original-Received: from localhost ([::1]:37686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQuls-00012e-Tj for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Aug 2022 14:06:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQulP-0000q2-6s for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 14:06:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQulO-0000f5-UE for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 14:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQulO-0004ht-JL for bug-gnu-emacs@gnu.org; Wed, 24 Aug 2022 14:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Ki=C3=AAn_?= =?UTF-8?Q?Nguy=E1=BB=85n?= Quang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Aug 2022 18:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57386 X-GNU-PR-Package: emacs Original-Received: via spool by 57386-submit@debbugs.gnu.org id=B57386.166136435918085 (code B ref 57386); Wed, 24 Aug 2022 18:06:02 +0000 Original-Received: (at 57386) by debbugs.gnu.org; 24 Aug 2022 18:05:59 +0000 Original-Received: from localhost ([127.0.0.1]:48167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQulL-0004hc-Dn for submit@debbugs.gnu.org; Wed, 24 Aug 2022 14:05:59 -0400 Original-Received: from mail-ed1-f54.google.com ([209.85.208.54]:38682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQulJ-0004hL-4a for 57386@debbugs.gnu.org; Wed, 24 Aug 2022 14:05:57 -0400 Original-Received: by mail-ed1-f54.google.com with SMTP id a22so23070295edj.5 for <57386@debbugs.gnu.org>; Wed, 24 Aug 2022 11:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=7ZFnMv7NK7jCXqEqQwjkf/MX3T/+3lr/CQrxg+D2IJ8=; b=fMpHTjClvB04KjgCy6tqxHLEvdcv0y/7KfrwBGqXUpfbPKA7jegDBPk72j9R7FdYm8 S9GmRynykW21qbgE4pBBMjn1BNMLUlu8tdjxg/lbuV/R9RzFSkrq7xDXh0F4bSKlFlxv 7EeAd/6FWgKklMG9wEu1pgyd1USwB/k/OhRcUOGqYQxWgeCE2zMvo9nyLQGAIniJYCgY E/jTjWiiyf46wZ6hQPdYdmWlKlWH46EP8s4zYMwInvz2M/oyhpnueJvlA7pv6t5vMEAg +DOYyeC0sKCYpYAlrNP1btVy+j/dJK6hmtF+B7LLnxlH8ESAemzmjwuZBah9+spItSKm Wo+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=7ZFnMv7NK7jCXqEqQwjkf/MX3T/+3lr/CQrxg+D2IJ8=; b=p8Wapradwf3e304GugrXY1EA51GdYP0d1OmCWCRCdznPi7WRsyG0UvUhFBtA5w4okL 1FoaSAZqH2DOIWwZUciHcH159XrU7LQLzFEj4cZ6QtLn8db5gt8cvFAjDJyoxqWjudpd 1bB44ZhYnlPBeI3evaKMA1wEOk/Zu5INmqU0JfaptbOT/bqXKkXaxMwtJspcTy9zWISm /QgL7J3WGeZVViGGtO7P5xezK6HMjjG2VdTNcFxs4q7nf4gdwm0OX8ylUUWRg7DPHUX3 5JLGD2M9LhoEk3PPYkPj+OtArv3apAupS5VbtKARrRRwbDjObGEcXCaPhTPwQRNVaeA8 QLhA== X-Gm-Message-State: ACgBeo34PsA5xmJ+6HfCslra5nfrmYAIBq8cYHOoJePc1y07of3JnNJ9 /oK1+tydXcad2s2onQLtxEFS4j0i9cpak09Lkm5RRKIKM1I= X-Google-Smtp-Source: AA6agR66DilcplerM6WKUb7NRRMTc1sI/mQtEBCPqG7nbMSjwzlSitk7ZkUk5RRYloDUn+cd4PuGdV914qB6xC5QdWM= X-Received: by 2002:a05:6402:2792:b0:446:8864:26c1 with SMTP id b18-20020a056402279200b00446886426c1mr212094ede.70.1661364351038; Wed, 24 Aug 2022 11:05:51 -0700 (PDT) In-Reply-To: <838rnd638m.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240649 Archived-At: --000000000000fc94c605e700875e Content-Type: multipart/alternative; boundary="000000000000fc94c405e700875c" --000000000000fc94c405e700875c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable You're right, there's a stupid check against parameters on the version that doesn't support the new flag. Since from Windows 10, the Windows version checking is not recommended (and not accurate) anymore, I think we can just retry if the function is called with invalid parameters. That will probably slow down the down-level Windows versions, but the difference should not be too much. On Thu, Aug 25, 2022 at 1:00 AM Eli Zaretskii wrote: > > From: Ki=C3=AAn Nguy=E1=BB=85n Quang > > > > Date: Thu, 25 Aug 2022 00:33:58 +0900 > > > > The CreateSymbolicLink Win32API has a flag that allows creating > sym-links without admin privileges > > SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE. > > This patch added that support for w32 Emacs. > > Thanks, but we cannot use that flag unconditionally, because it is not > supported on all Windows versions. The addition of the flags should > be conditioned on the version of Windows on which Emacs runs. > --000000000000fc94c405e700875c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You're right, there's a stupid ch= eck against parameters on the version that doesn't support the new flag= .
Since from Windows 10, the Windows version checking is not reco= mmended (and not accurate) anymore, I think we can just retry if the functi= on is called with invalid parameters.
That will probably slow dow= n the down-level Windows versions, but the difference should not be too muc= h.

On Thu, Aug 25, 2022 at 1:00 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Ki=C3=AAn Nguy=E1=BB=85n Quang
>=C2=A0 <= kien.n.quang@gmail.com>
> Date: Thu, 25 Aug 2022 00:33:58 +0900
>
> The CreateSymbolicLink Win32API has a flag that allows creating sym-li= nks without admin privileges
> SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE.
> This patch added that support for w32 Emacs.

Thanks, but we cannot use that flag unconditionally, because it is not
supported on all Windows versions.=C2=A0 The addition of the flags should be conditioned on the version of Windows on which Emacs runs.



--000000000000fc94c405e700875c-- --000000000000fc94c605e700875e Content-Type: application/octet-stream; name="0001-symlink-allow-w32-user-to-create-symlink-without-adm.patch" Content-Disposition: attachment; filename="0001-symlink-allow-w32-user-to-create-symlink-without-adm.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l77xf8m90 RnJvbSAzYWRlODQzNmI5YzRhMGM4ZDcxYTI1MjA2OGFiZjM3MGViZTg0OGJhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBLaWVuIE5ndXllbiA8a2llbi5uLnF1YW5nQGdtYWlsLmNvbT4K RGF0ZTogV2VkLCAyNCBBdWcgMjAyMiAyMzoxOTozNSArMDkwMApTdWJqZWN0OiBbUEFUQ0hdIHN5 bWxpbms6IGFsbG93IHczMiBub24tYWRtaW4gdXNlciB0byBjcmVhdGUgc3ltbGluawoKKiBzcmMv dzMyLmMgKHN5bWxpbmspOiBhbGxvdyB3MzIgdXNlciB0byBjcmVhdGUgc3ltbGluayB3aXRob3V0 IGFkbWluIHByaXZpbGVnZWQKCi0tLQogc3JjL3czMi5jIHwgMTkgKysrKysrKysrKysrKysrKyst LQogMSBmaWxlIGNoYW5nZWQsIDE3IGluc2VydGlvbnMoKyksIDIgZGVsZXRpb25zKC0pCgpkaWZm IC0tZ2l0IGEvc3JjL3czMi5jIGIvc3JjL3czMi5jCmluZGV4IGNiY2ZjZGQ0Zi4uNDA3YmVmYmRh IDEwMDY0NAotLS0gYS9zcmMvdzMyLmMKKysrIGIvc3JjL3czMi5jCkBAIC01OTkyLDEy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k9MSUNfTElOS19GTEFHX0RJUkVDVE9SWTsKIAogICB0Z3RmbiA9IChjaGFy ICopbWFwX3czMl9maWxlbmFtZSAoZmlsZW5hbWUsIE5VTEwpOwogICBpZiAoZmlsZW5hbWVfZW5k c19pbl9zbGFzaCkKQEAgLTYwNjksNiArNjA3MiwxNiBAQCBzeW1saW5rIChjaGFyIGNvbnN0ICpm aWxlbmFtZSwgY2hhciBjb25zdCAqbGlua25hbWUpCiAgICAgICBpZiAoZXJybm8gIT0gRU5PU1lT KQogCXsKIAkgIERXT1JEIHczMmVyciA9IEdldExhc3RFcnJvciAoKTsKKwkgIC8qIFJlbW92ZSB0 aGUgZmxhZyBhbmQgdHJ5IGFnYWluIGlmIHRoZSBBUEkgaXMgbm90IHN1cHBvcnRlZCAqLworCSAg aWYgKHczMmVyciA9PSBFUlJPUl9JTlZBTElEX1BBUkFNRVRFUikKKwkgICAgeworCSAgICAgIGVy cm5vID0gMDsKKwkgICAgICBmbGFncyAmPSB+U1lNQk9MSUNfTElOS19GTEFHX0FMTE9XX1VOUFJJ VklMRUdFRF9DUkVBVEU7CisJICAgICAgaWYgKGNyZWF0ZV9zeW1ib2xpY19saW5rIChsaW5rZm4s IHRndGZuLCBmbGFncykpCisJCWdvdG8gc3VjY2VzczsKKworCSAgICAgIHczMmVyciA9IEdldExh c3RFcnJvciAoKTsKKwkgICAgfQogCiAJICBzd2l0Y2ggKHczMmVycikKIAkgICAgewpAQCAtNjEw NCw2ICs2MTE3LDggQEAgc3ltbGluayAoY2hhciBjb25zdCAqZmlsZW5hbWUsIGNoYXIgY29uc3Qg KmxpbmtuYW1lKQogCX0KICAgICAgIHJldHVybiAtMTsKICAgICB9CisKKyBzdWNjZXNzOgogICBy ZXR1cm4gMDsKIH0KIAotLSAKMi4zNy4wLndpbmRvd3MuMQoK --000000000000fc94c605e700875e--