delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 9FCA73858C39 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1691949710; | |
bh=3gja+WZEwPPcfK9gkNGBuo3rjM6DUjTiYjMpjFg0sCs=; | |
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=VflrwGu+HpX189sv39A+QvOMvzoeYPE2Ifr/gpBCTroIC/irrnU+v9HOCPMb3PMnj | |
PfsGHOBL/U5ThQ0pC4KK7tWnNMho5ekbJDEPQpkmEyW2KUu0ebfTRnewHEYBMl3hws | |
mQAEmzrSXVv4EpTdzQhMHlg3qgfR9GSm6VsUqV1E= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 6DBAE3858D32 |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20221208; t=1691949673; x=1692554473; | |
h=content-transfer-encoding:to:subject:message-id:date:from | |
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc | |
:subject:date:message-id:reply-to; | |
bh=STNqawTqXWJJjnrv22NvxUiBibJOp3QjlrHEh+bdBFE=; | |
b=Uiu0WcC1iEY2drHxyA5u9filpasoHphBKHYet/GduHCHAaXRgWr1m8TUkeInNr/wsJ | |
DgfAXhlKuix224MWGhlFjTzi55yecTF7B0gwR9wlsRe1UMcwPibuSWnOkwdqnNvPQXRn | |
1f5km2RwLpDvrd/46tQ3epRXi4XkxU4YkaHe+75kF41Mgm4bd5K+A2+yfZxnBrF+eS8/ | |
EMTmuhW2SuHtnXl62mmYGbgZiXdbuWaDJjD4s8Nh1salKl7Q6T4NXfCjxddq7g4YfweD | |
BDpp6C6N/rOEY8jzAlrfw6+jlCrlheJPZILbNBnSye9V8TB2SU5tMTH/hkjpyc/FZTXc | |
FzCA== | |
X-Gm-Message-State: | AOJu0Yzv9gnUCaYiTLuh058PzmjxJENUCT9RiVv1Qmn33Gt+nfnRcnyn |
B0szzw3relm7pKmh0Ga1cFVvGEAlDfEIfa5Zha2S5NFb | |
X-Google-Smtp-Source: | AGHT+IEHtzI2zHovUqM+3aQ/Mu3ksqneDQVxDRbp67UARKUQk03lITFQFMxmUKZGBrX66fuP5uOQ8Lo63SocvLHNDGs= |
X-Received: | by 2002:a4a:3408:0:b0:566:f763:8fb7 with SMTP id |
b8-20020a4a3408000000b00566f7638fb7mr4805399ooa.2.1691949672808; Sun, 13 Aug | |
2023 11:01:12 -0700 (PDT) | |
MIME-Version: | 1.0 |
References: | <CANH4o6MPFhU-zaFiK+CRFi3HQRMTEW=yYc5kgiUP8O2Q2-L1Ww AT mail DOT gmail DOT com> |
<ZNX3a2DoNnY4whY8 AT calimero DOT vinschen DOT de> | |
<CAKAoaQmxjomp1UGTha0dkKMdEQNacraOXp_Wscxpwk+w7o6ZTA AT mail DOT gmail DOT com> | |
<CANH4o6PVVKA+eZpH5T6tqEM4+5hZ0t92A7rJgJuJXX_+zqK4gA AT mail DOT gmail DOT com> | |
In-Reply-To: | <CANH4o6PVVKA+eZpH5T6tqEM4+5hZ0t92A7rJgJuJXX_+zqK4gA@mail.gmail.com> |
Date: | Sun, 13 Aug 2023 20:01:00 +0200 |
Message-ID: | <CANH4o6MFFWqP5UYotjbfqJZv3jEtqWzyFQw+ZTLUFYiXakpsaw@mail.gmail.com> |
Subject: | Re: Cygwin breaks net use Z: /delete in scripts? |
To: | cygwin AT cygwin DOT com |
X-Spam-Status: | No, score=2.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FOREIGN_BODY1, FREEMAIL_FROM, | |
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, | |
TXREP autolearn=no autolearn_force=no version=3.4.6 | |
X-Spam-Level: | ** |
X-Spam-Checker-Version: | SpamAssassin 3.4.6 (2021-04-09) on |
server2.sourceware.org | |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Martin Wege via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Martin Wege <martin DOT l DOT wege AT gmail DOT com> |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 37DI1pPn004913 |
On Sun, Aug 13, 2023 at 7:13 PM Martin Wege <martin DOT l DOT wege AT gmail DOT com> wrote: > > On Sun, Aug 13, 2023 at 12:43 AM Roland Mainz via Cygwin > <cygwin AT cygwin DOT com> wrote: > > > > On Fri, Aug 11, 2023 at 10:55 AM Corinna Vinschen via Cygwin > > <cygwin AT cygwin DOT com> wrote: > > [snip] > > > On Aug 11 10:25, Martin Wege wrote: > > > > Cygwin somehow breaks unmounting of network shares, but ONLY if the > > > > net use /delete happens in a bash shell script. > > > > > > > > Example: > > > > Mount SMB network share on Z: > > > > Do not touch Z:! > > > > > > > > Then do a net use /delete in a bash script: > > > > net use Z: /delete > > > > Systemfehler 1794 aufgetreten. > > > > Der Redirector wird verwendet und kann nicht aus dem Speicher entfernt werden. > > > > > > > > If I execute the net use Z: /delete in an interactive bash shell it works. > > > > > > > > Can anyone explain this? > > > > > > Something is wrong on your side, but no, I can't explain it. It's > > > not related to Cygwin: > > > > > > $ cat > b.sh <<EOF > > > #!/bin/bash > > > net use Z: /delete > > > EOF > > > $ chmod +x b.sh > > > $ net use Z: \\\\server\\share > > > The command completed successfully. > > > > > > B:[~]$ ./b.sh > > > Z: was deleted successfully. > > > > I think it's the problem that a shell keeps a fd open to the shell > > script's file. > > > > Example: > > ---- snip ---- > > $ cat shellfd.ksh > > #!/bin/ksh93 > > # shell script printing the fd which the shell > > # process has open right now > > ls -l /proc/$$/fd/ > > true # needed here so ksh93 doesn't make a tail optimisation > > exit 0 > > $ bash shellfd.ksh > > total 0 > > lrwx------ 1 test001 users 64 Aug 13 00:26 0 -> /dev/pts/7 > > lrwx------ 1 test001 users 64 Aug 13 00:26 1 -> /dev/pts/7 > > lrwx------ 1 test001 users 64 Aug 13 00:26 2 -> /dev/pts/7 > > lr-x------ 1 test001 users 64 Aug 13 00:26 255 -> /cygdrive/h/tmp/shellfd.ksh > > $ ksh93 shellfd.ksh > > total 0 > > lrwx------ 1 test001 users 64 Aug 13 00:26 0 -> /dev/pts/7 > > lrwx------ 1 test001 users 64 Aug 13 00:26 1 -> /dev/pts/7 > > lr-x------ 1 test001 users 64 Aug 13 00:26 10 -> /cygdrive/h/tmp/shellfd.ksh > > lrwx------ 1 test001 users 64 Aug 13 00:26 2 -> /dev/pts/7 > > ---- snip ---- > > > > So both bash4 an ksh93 keep a fd to the shell script ("shellfd.ksh") > > around (I even tried /usr/bin/shcomp to make shell bytecode, but the > > issue remains...) > > > > And here comes the nasty part: If shellfd.ksh is on a network > > filesystem (in my test setup my home dir, mounted at H:), then in some > > cases (I do not know why) a $ net use Z: /delete # will fail with > > error #1794 if both network filesystems are from the same server. > > > > This is NOT the same as the script tries to unmount the filesystem it > > is residing on - Z: is mounted separately, and a different exported > > directory than H:, and yet I can reproduce that issue (after around > > 30-40 experiments, until I remembered that ksh93 keeps a fd to the > > script open). > > > > This sounds a lot like a Windows bug. > > > > Martin: Do you have more than one network filesystem mounted on your machine ? > > Yes, usually 12-14 filesystems mounted per machine. This includes user > directories, and several directories where the software and production > data come from. I still have to test whether putting software on a > local disk solves the problem. Maybe I should better call this a > workaround for a silly Windows restriction. Yeah, putting software on a local disk allows me to do a successful net use Z: /delete So what do we do now? File a bug at Microsoft support, and they fix that for Windows 12 in 2038? Thanks, Martin -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |