help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help-bash Digest, Vol 140, Issue 18


From: Budi
Subject: Re: Help-bash Digest, Vol 140, Issue 18
Date: Mon, 26 Jun 2023 23:29:22 +0700

Greg Wooledge <greg@wooledge.org>,

EXCELLENT !

Thanks billion !

On 6/26/23, help-bash-request@gnu.org <help-bash-request@gnu.org> wrote:
> Send Help-bash mailing list submissions to
>       help-bash@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.gnu.org/mailman/listinfo/help-bash
> or, via email, send a message with subject or body 'help' to
>       help-bash-request@gnu.org
>
> You can reach the person managing the list at
>       help-bash-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Help-bash digest..."
>
>
> Today's Topics:
>
>    1. Every certain user ownership under a directory is replaced
>       with another user's (Budi)
>    2. Re: Every certain user ownership under a directory is
>       replaced with another user's (Greg Wooledge)
>    3. Re: Every certain user ownership under a directory is
>       replaced with another user's (63l618u2@duck.com)
>    4. Re: Every certain user ownership under a directory is
>       replaced with another user's (Lawrence Velázquez)
>    5. Re: Help fixing NativeMessaging host: read 32-bit message
>       length in native byte order (alex xmb ratchev)
>    6. Re: Help fixing NativeMessaging host: read 32-bit message
>       length in native byte order (guest271314)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 26 Jun 2023 09:18:13 +0700
> From: Budi <budikusasi@gmail.com>
> To: help-bash@gnu.org
> Subject: Every certain user ownership under a directory is replaced
>       with another user's
> Message-ID:
>       <CAH0GyZAJQS7F7dmfv83g38wRReEuLrRDqfinp7fve+UV__LkUQ@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Sorry as it's not really bash
>
> How on Linux do we replace every certain  user ownership under a
> directory with another user's
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 25 Jun 2023 22:23:02 -0400
> From: Greg Wooledge <greg@wooledge.org>
> To: help-bash@gnu.org
> Subject: Re: Every certain user ownership under a directory is
>       replaced with another user's
> Message-ID: <ZJj2hjHQsn1NKNXc@wooledge.org>
> Content-Type: text/plain; charset=us-ascii
>
> On Mon, Jun 26, 2023 at 09:18:13AM +0700, Budi wrote:
>> How on Linux do we replace every certain  user ownership under a
>> directory with another user's
>
> Use find(1).
>
> For example: find . -user oldname -exec chown newname {} +
>
>
>
> ------------------------------
>
> Message: 3
> Date: Sun, 25 Jun 2023 23:41:44 -0400
> From: 63l618u2@duck.com
> To: Greg Wooledge <greg@wooledge.org>
> Cc: "help-bash@gnu.org" <help-bash@gnu.org>
> Subject: Re: Every certain user ownership under a directory is
>       replaced with another user's
> Message-ID:
>       <8BD7FB72-BA86-4175-8A2B-BBB19850FDF1.1@smtp-inbound1.duck.com>
> Content-Type: text/plain;     charset=UTF-8
>
>
> chown -R user:group /parent/directory
>
>
> --
> Regards,
> Kat O'Kelly
> Principal Engineer
> Light River, LLC
>
>
>
>
> Jun 25, 2023, 22:23 by greg_at_wooledge.org_63l618u2@duck.com:
>
>> On Mon, Jun 26, 2023 at 09:18:13AM +0700, Budi wrote:
>>
>>> How on Linux do we replace every certain  user ownership under a
>>> directory with another user's
>>>
>>
>> Use find(1).
>>
>> For example: find . -user oldname -exec chown newname {} +
>>
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Sun, 25 Jun 2023 23:49:36 -0400
> From: Lawrence Velázquez <vq@larryv.me>
> To: 63l618u2@duck.com
> Cc: help-bash@gnu.org
> Subject: Re: Every certain user ownership under a directory is
>       replaced with another user's
> Message-ID: <9169dfb1-aa4e-44ed-8191-971b4b438c03@app.fastmail.com>
> Content-Type: text/plain
>
> On Sun, Jun 25, 2023, at 11:41 PM, 63l618u2@duck.com wrote:
>> chown -R user:group /parent/directory
>
> This sets the ownership of every directory entry, while (I think)
> the OP only wants to change entries that are currently owned by
> a particular user.
>
> --
> vq
>
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 26 Jun 2023 14:27:18 +0200
> From: alex xmb ratchev <fxmbsw7@gmail.com>
> To: guest271314 <guest271314@gmail.com>
> Cc: bash list <help-bash@gnu.org>
> Subject: Re: Help fixing NativeMessaging host: read 32-bit message
>       length in native byte order
> Message-ID:
>       <CAALKErEsS0N6Tcu-Gidiv+=zGq6gCjVd+a+SPcW5NX3hYzv9dQ@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> On Sat, Jun 24, 2023, 15:34 guest271314 <guest271314@gmail.com> wrote:
>
>> I have been trying to write a Native Messaging host in Bash comparable to
>> C, C++, Python, and JavaScript versions, trying to determine if Bash is
>> capable of doing so after reading
>>
>> https://stackoverflow.com/questions/24764657/how-do-i-use-a-shell-script-as-chrome-native-messaging-host-application
>> .
>> This is the Native messaging protocol
>>
>> https://developer.chrome.com/docs/extensions/mv3/nativeMessaging/#native-messaging-host-protocol
>> .
>>
>> > Chrome starts each native messaging host in a separate process and
>> communicates with it using standard input (stdin) and standard output
>> (stdout). The same format is used to send messages in both directions;
>> each
>> message is serialized using JSON, UTF-8 encoded and is preceded with
>> 32-bit
>> message length in native byte order. The maximum size of a single message
>> from the native messaging host is 1 MB, mainly to protect Chrome from
>> misbehaving native applications. The maximum size of the message sent to
>> the native messaging host is 4 GB.
>>
>> This is what I came up for getMessage
>> https://github.com/guest271314/native-messaging-bash/blob/main/nm_bash.sh,
>> the part I need help with is reading message length. In C, C++, Python,
>> JavaScript I can pass new Array(209715) from JavaScript (1 MB) to the host
>> and get the message echo'ed back. In the code below new Array(408) (JSON
>> length 2041) is echo'ed back, over that input length no message is echo'ed
>> back. How do I reliably read 32-bit message length in native byte order
>> using GN Core Utilities in Bash?
>>
>> getMessage() {
>>   read -N 1 uint32
>>   # https://unix.stackexchange.com/a/13141
>>   header=0x$(printf "%s" "$uint32" |
>>   od -t x8 -An |
>>   tr -dc '[:alnum:]')
>>   messageLength=$(printf "%d" "$header")
>>   array=()
>>   read -N "$messageLength" json
>>   array+=("$json")
>>   sendMessage "${array[@]}"
>> }
>>
>
> u realize .. -N 1 to read may read 0 - 9 , one number , not 32 or anything
> else but ' 1 char / number '
> or am i lost ..
>
>>
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 26 Jun 2023 07:03:04 -0700
> From: guest271314 <guest271314@gmail.com>
> To: alex xmb ratchev <fxmbsw7@gmail.com>
> Cc: bash list <help-bash@gnu.org>
> Subject: Re: Help fixing NativeMessaging host: read 32-bit message
>       length in native byte order
> Message-ID:
>       <CA+syWANSoPON+iQhJvapNMzaKh-ORC9RR35hugzPnvanzffLtQ@mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Yes. I was trying to read 1 char. I think we have at least two working
> examples not for how to read the length of the message from the client.
>
> On Mon, Jun 26, 2023 at 5:27 AM alex xmb ratchev <fxmbsw7@gmail.com> wrote:
>
>>
>>
>> On Sat, Jun 24, 2023, 15:34 guest271314 <guest271314@gmail.com> wrote:
>>
>>> I have been trying to write a Native Messaging host in Bash comparable to
>>> C, C++, Python, and JavaScript versions, trying to determine if Bash is
>>> capable of doing so after reading
>>>
>>> https://stackoverflow.com/questions/24764657/how-do-i-use-a-shell-script-as-chrome-native-messaging-host-application
>>> .
>>> This is the Native messaging protocol
>>>
>>> https://developer.chrome.com/docs/extensions/mv3/nativeMessaging/#native-messaging-host-protocol
>>> .
>>>
>>> > Chrome starts each native messaging host in a separate process and
>>> communicates with it using standard input (stdin) and standard output
>>> (stdout). The same format is used to send messages in both directions;
>>> each
>>> message is serialized using JSON, UTF-8 encoded and is preceded with
>>> 32-bit
>>> message length in native byte order. The maximum size of a single message
>>> from the native messaging host is 1 MB, mainly to protect Chrome from
>>> misbehaving native applications. The maximum size of the message sent to
>>> the native messaging host is 4 GB.
>>>
>>> This is what I came up for getMessage
>>> https://github.com/guest271314/native-messaging-bash/blob/main/nm_bash.sh
>>> ,
>>> the part I need help with is reading message length. In C, C++, Python,
>>> JavaScript I can pass new Array(209715) from JavaScript (1 MB) to the
>>> host
>>> and get the message echo'ed back. In the code below new Array(408) (JSON
>>> length 2041) is echo'ed back, over that input length no message is
>>> echo'ed
>>> back. How do I reliably read 32-bit message length in native byte order
>>> using GN Core Utilities in Bash?
>>>
>>> getMessage() {
>>>   read -N 1 uint32
>>>   # https://unix.stackexchange.com/a/13141
>>>   header=0x$(printf "%s" "$uint32" |
>>>   od -t x8 -An |
>>>   tr -dc '[:alnum:]')
>>>   messageLength=$(printf "%d" "$header")
>>>   array=()
>>>   read -N "$messageLength" json
>>>   array+=("$json")
>>>   sendMessage "${array[@]}"
>>> }
>>>
>>
>> u realize .. -N 1 to read may read 0 - 9 , one number , not 32 or anything
>> else but ' 1 char / number '
>> or am i lost ..
>>
>>>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Help-bash mailing list
> Help-bash@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-bash
>
>
> ------------------------------
>
> End of Help-bash Digest, Vol 140, Issue 18
> ******************************************
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]