public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* See repeated /usr/bin in my path
@ 2024-04-17 17:10 J M
  2024-04-17 17:29 ` J M
  2024-04-17 20:58 ` Doug Henderson
  0 siblings, 2 replies; 8+ messages in thread
From: J M @ 2024-04-17 17:10 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

Hi,

I see repeated /usr/bin in my path.
I don't known if is something of my PC or not.

To check I do:
which -a ls
Show:
/usr/bin/ls
/usr/bin/ls

My path is:
/usr/local/bin
/usr/bin
...
/usr/bin
...

Seeing other files, I reach to /etc/profile and use one variable
ORIGINAL_PATH that contains one /usr/bin.

But I can no longer see where that variable is set or if it is not from
Cygwin.

Regards

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-17 17:10 See repeated /usr/bin in my path J M
@ 2024-04-17 17:29 ` J M
  2024-04-17 21:22   ` Andrey Repin
  2024-04-17 20:58 ` Doug Henderson
  1 sibling, 1 reply; 8+ messages in thread
From: J M @ 2024-04-17 17:29 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

I think that is a bug, in my Windows environment path I have this:
C:\cygwin64\bin

Then for some mystery change this to /usr/bin, instead to delete.
You can file an issue?

Regards




El mié, 17 abr 2024 a las 19:10, J M (<cesarjorgemartinez@gmail.com>)
escribió:

> Hi,
>
> I see repeated /usr/bin in my path.
> I don't known if is something of my PC or not.
>
> To check I do:
> which -a ls
> Show:
> /usr/bin/ls
> /usr/bin/ls
>
> My path is:
> /usr/local/bin
> /usr/bin
> ...
> /usr/bin
> ...
>
> Seeing other files, I reach to /etc/profile and use one variable
> ORIGINAL_PATH that contains one /usr/bin.
>
> But I can no longer see where that variable is set or if it is not from
> Cygwin.
>
> Regards
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-17 17:10 See repeated /usr/bin in my path J M
  2024-04-17 17:29 ` J M
@ 2024-04-17 20:58 ` Doug Henderson
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Henderson @ 2024-04-17 20:58 UTC (permalink / raw)
  To: J M; +Cc: cygwin

On Wed, Apr 17, 2024 at 11:11 AM J M via Cygwin <cygwin@cygwin.com> wrote:
>
> Hi,
>
> I see repeated /usr/bin in my path.
> I don't known if is something of my PC or not.
>
> To check I do:
> which -a ls
> Show:
> /usr/bin/ls
> /usr/bin/ls

This is normal! We do this because on Linux, the two paths may be different,
e.g on different file systems.

Try this:
$ ls -li $(which -a ls)
5910974510956900 -rwxr-xr-x 1 Admin None 148K Jul 14  2022 /bin/ls*
5910974510956900 -rwxr-xr-x 1 Admin None 148K Jul 14  2022 /usr/bin/ls*

and look at
$ mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)

which shows that /usr/bin is mounted on C:/cygwin64/bin which,
inside the cgywin environment, is /bin
because on my system C:/cygwin64/ is the root e.g. /

HTH
Doug

-- 
Doug Henderson, Calgary, Alberta, Canada - from gmail.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-17 17:29 ` J M
@ 2024-04-17 21:22   ` Andrey Repin
  2024-04-17 21:43     ` J M
  0 siblings, 1 reply; 8+ messages in thread
From: Andrey Repin @ 2024-04-17 21:22 UTC (permalink / raw)
  To: J M, cygwin

Greetings, J M!

> I think that is a bug, in my Windows environment path I have this:
> C:\cygwin64\bin

> Then for some mystery change this to /usr/bin, instead to delete.
> You can file an issue?

It's not a bug, it's how Cygwin works.
If you want to have Cygwin in your system PATH, you'll have to, either
a) tolerate the duplicated entries in session's $PATH, or
b) do something to fix it.

I use this scriptlet:

PATH="$( tr ":" "\\n" <<<"$HOME/bin:$HOME/.local/bin:/usr/local/bin:/bin:$PATH" | sed -Ee "1,4b; \\#Subversion|$HOME|^(/usr(/local)?)?/bin\$#d;" | paste -sd:)" export PATH

(Essentially, I push 4 predefined paths on top of the stack, then filter out
the rest of the stack by some known patterns.)


-- 
With best regards,
Andrey Repin
Thursday, April 18, 2024 00:07:59

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-17 21:22   ` Andrey Repin
@ 2024-04-17 21:43     ` J M
  2024-04-18 16:41       ` Andrey Repin
  0 siblings, 1 reply; 8+ messages in thread
From: J M @ 2024-04-17 21:43 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

Hi Andrew,

Isn't it better that original_path be removed all startwith
$mycygwin_homepath?

You have this scriptlet, but if you need all to work with all Linux
distributions you need yo add unnecessary work, multiple code and cases for
all, and complicate all.

Regards

El mié., 17 abr. 2024 23:35, Andrey Repin <anrdaemon@yandex.ru> escribió:

> Greetings, J M!
>
> > I think that is a bug, in my Windows environment path I have this:
> > C:\cygwin64\bin
>
> > Then for some mystery change this to /usr/bin, instead to delete.
> > You can file an issue?
>
> It's not a bug, it's how Cygwin works.
> If you want to have Cygwin in your system PATH, you'll have to, either
> a) tolerate the duplicated entries in session's $PATH, or
> b) do something to fix it.
>
> I use this scriptlet:
>
> PATH="$( tr ":" "\\n"
> <<<"$HOME/bin:$HOME/.local/bin:/usr/local/bin:/bin:$PATH" | sed -Ee "1,4b;
> \\#Subversion|$HOME|^(/usr(/local)?)?/bin\$#d;" | paste -sd:)" export PATH
>
> (Essentially, I push 4 predefined paths on top of the stack, then filter
> out
> the rest of the stack by some known patterns.)
>
>
> --
> With best regards,
> Andrey Repin
> Thursday, April 18, 2024 00:07:59
>
> Sorry for my terrible english...
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-17 21:43     ` J M
@ 2024-04-18 16:41       ` Andrey Repin
  2024-04-18 16:59         ` Eliot Moss
  2024-04-19 14:45         ` J M
  0 siblings, 2 replies; 8+ messages in thread
From: Andrey Repin @ 2024-04-18 16:41 UTC (permalink / raw)
  To: J M, cygwin

Greetings, J M!

> Isn't it better that original_path be removed all startwith
> $mycygwin_homepath?

$original_path is stored once when you first run Cygwin with empty home
profile, IIRC. And not used anywhere.

> You have this scriptlet, but if you need all to work with all Linux
> distributions you need yo add unnecessary work, multiple code and cases for
> all, and complicate all.

It's in ~/.bashrc.d/. And not copied over to *NIX systems.

P.S.
Please do not top-post in this list.


-- 
With best regards,
Andrey Repin
Thursday, April 18, 2024 19:39:05

Sorry for my terrible english...


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-18 16:41       ` Andrey Repin
@ 2024-04-18 16:59         ` Eliot Moss
  2024-04-19 14:45         ` J M
  1 sibling, 0 replies; 8+ messages in thread
From: Eliot Moss @ 2024-04-18 16:59 UTC (permalink / raw)
  To: cygwin, J M; +Cc: Andrey Repin

On 4/18/2024 12:41 PM, Andrey Repin via Cygwin wrote:
> Greetings, J M!
> 
>> Isn't it better that original_path be removed all startwith
>> $mycygwin_homepath?
> 
> $original_path is stored once when you first run Cygwin with empty home
> profile, IIRC. And not used anywhere.

That seems to be ORIGINAL_PATH (upper case variable name).

Regards - Eliot Moss

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: See repeated /usr/bin in my path
  2024-04-18 16:41       ` Andrey Repin
  2024-04-18 16:59         ` Eliot Moss
@ 2024-04-19 14:45         ` J M
  1 sibling, 0 replies; 8+ messages in thread
From: J M @ 2024-04-19 14:45 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1423 bytes --]

El jue., 18 abr. 2024 18:50, Andrey Repin <anrdaemon@yandex.ru> escribió:

> Greetings, J M!
>
> > Isn't it better that original_path be removed all startwith
> > $mycygwin_homepath?
>
> $original_path is stored once when you first run Cygwin with empty home
> profile, IIRC. And not used anywhere.
> ,
> > You have this scriptlet, but if you need all to work with all Linux
> > distributions you need yo add unnecessary work, multiple code and cases
> for
> > all, and complicate all.
>
> It's in ~/.bashrc.d/. And not copied over to *NIX systems.
>
> P.S.
> Please do not top-post in this list.
>
>
> --
> With best regards,
> Andrey Repin
> Thursday, April 18, 2024 19:39:05
>
> Sorry for my terrible english...
>

Thank you Andrew, I didn't know the meaning of top-posting, using gmail
puts you at the beginning. And my english is very poor, I'm spanish.

Then, over this problem, its a pretty form to change the behaviour of
Cygwin from outside, simply setting the path cygwin64... the way you want.
Its a side effect... Appart of failed scripts, and I'm not in the security
branches, its a pretty form to inyect things to change behavihours.

I recommend to disable or erase all paths that refer to C:\cygwin64 or root
path.

For reference, here https://gist.github.com/mpicker0/a6a3f10e6b9278074f93,
show the use of Windows environment variable C:\cygwin64\bin.

Regards

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-19 14:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 17:10 See repeated /usr/bin in my path J M
2024-04-17 17:29 ` J M
2024-04-17 21:22   ` Andrey Repin
2024-04-17 21:43     ` J M
2024-04-18 16:41       ` Andrey Repin
2024-04-18 16:59         ` Eliot Moss
2024-04-19 14:45         ` J M
2024-04-17 20:58 ` Doug Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).