Skip to content

Commit 157e964

Browse files
committed
deploy: f0e8d44
1 parent 9ba20bd commit 157e964

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+187
-59
lines changed

dev/implementors/core/marker/trait.Freeze.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/implementors/core/marker/trait.Send.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/implementors/core/marker/trait.Sync.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/implementors/core/marker/trait.Unpin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/implementors/core/panic/unwind_safe/trait.RefUnwindSafe.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/implementors/core/panic/unwind_safe/trait.UnwindSafe.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/search-index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/src/uu_chgrp/chgrp.rs.html

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@
152152
<a href="#152" id="152">152</a>
153153
<a href="#153" id="153">153</a>
154154
<a href="#154" id="154">154</a>
155+
<a href="#155" id="155">155</a>
156+
<a href="#156" id="156">156</a>
157+
<a href="#157" id="157">157</a>
158+
<a href="#158" id="158">158</a>
159+
<a href="#159" id="159">159</a>
160+
<a href="#160" id="160">160</a>
161+
<a href="#161" id="161">161</a>
162+
<a href="#162" id="162">162</a>
163+
<a href="#163" id="163">163</a>
164+
<a href="#164" id="164">164</a>
165+
<a href="#165" id="165">165</a>
155166
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
156167
//
157168
// (c) Jian Zeng &lt;anonymousknight96@gmail.com&gt;
@@ -164,7 +175,7 @@
164175
</span><span class="kw">use </span>uucore::display::Quotable;
165176
<span class="kw">pub use </span>uucore::entries;
166177
<span class="kw">use </span>uucore::error::{FromIo, UResult, USimpleError};
167-
<span class="kw">use </span>uucore::perms::{chown_base, options, IfFrom};
178+
<span class="kw">use </span>uucore::perms::{chown_base, options, GidUidOwnerFilter, IfFrom};
168179
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage};
169180

170181
<span class="kw">use </span>clap::{crate_version, Arg, ArgAction, ArgMatches, Command};
@@ -175,16 +186,22 @@
175186
<span class="kw">const </span>ABOUT: <span class="kw-2">&amp;</span>str = <span class="macro">help_about!</span>(<span class="string">&quot;chgrp.md&quot;</span>);
176187
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;chgrp.md&quot;</span>);
177188

178-
<span class="kw">fn </span>parse_gid_and_uid(matches: <span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;(<span class="prelude-ty">Option</span>&lt;u32&gt;, <span class="prelude-ty">Option</span>&lt;u32&gt;, IfFrom)&gt; {
189+
<span class="kw">fn </span>parse_gid_and_uid(matches: <span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;GidUidOwnerFilter&gt; {
190+
<span class="kw">let </span><span class="kw-2">mut </span>raw_group: String = String::new();
179191
<span class="kw">let </span>dest_gid = <span class="kw">if let </span><span class="prelude-val">Some</span>(file) = matches.get_one::&lt;String&gt;(options::REFERENCE) {
180192
fs::metadata(file)
181-
.map(|meta| <span class="prelude-val">Some</span>(meta.gid()))
193+
.map(|meta| {
194+
<span class="kw">let </span>gid = meta.gid();
195+
raw_group = entries::gid2grp(gid).unwrap_or_else(|<span class="kw">_</span>| gid.to_string());
196+
<span class="prelude-val">Some</span>(gid)
197+
})
182198
.map_err_context(|| <span class="macro">format!</span>(<span class="string">&quot;failed to get attributes of {}&quot;</span>, file.quote()))<span class="question-mark">?
183199
</span>} <span class="kw">else </span>{
184200
<span class="kw">let </span>group = matches
185201
.get_one::&lt;String&gt;(options::ARG_GROUP)
186202
.map(|s| s.as_str())
187203
.unwrap_or_default();
204+
raw_group = group.to_string();
188205
<span class="kw">if </span>group.is_empty() {
189206
<span class="prelude-val">None
190207
</span>} <span class="kw">else </span>{
@@ -199,7 +216,12 @@
199216
}
200217
}
201218
};
202-
<span class="prelude-val">Ok</span>((dest_gid, <span class="prelude-val">None</span>, IfFrom::All))
219+
<span class="prelude-val">Ok</span>(GidUidOwnerFilter {
220+
dest_gid,
221+
dest_uid: <span class="prelude-val">None</span>,
222+
raw_owner: raw_group,
223+
filter: IfFrom::All,
224+
})
203225
}
204226

205227
<span class="attr">#[uucore::main]

dev/src/uu_chown/chown.rs.html

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,23 @@
286286
<a href="#286" id="286">286</a>
287287
<a href="#287" id="287">287</a>
288288
<a href="#288" id="288">288</a>
289+
<a href="#289" id="289">289</a>
290+
<a href="#290" id="290">290</a>
291+
<a href="#291" id="291">291</a>
292+
<a href="#292" id="292">292</a>
293+
<a href="#293" id="293">293</a>
294+
<a href="#294" id="294">294</a>
295+
<a href="#295" id="295">295</a>
296+
<a href="#296" id="296">296</a>
297+
<a href="#297" id="297">297</a>
298+
<a href="#298" id="298">298</a>
299+
<a href="#299" id="299">299</a>
300+
<a href="#300" id="300">300</a>
301+
<a href="#301" id="301">301</a>
302+
<a href="#302" id="302">302</a>
303+
<a href="#303" id="303">303</a>
304+
<a href="#304" id="304">304</a>
305+
<a href="#305" id="305">305</a>
289306
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
290307
//
291308
// (c) Jian Zeng &lt;anonymousknight96@gmail.com&gt;
@@ -297,7 +314,7 @@
297314

298315
</span><span class="kw">use </span>uucore::display::Quotable;
299316
<span class="kw">pub use </span>uucore::entries::{<span class="self">self</span>, Group, Locate, Passwd};
300-
<span class="kw">use </span>uucore::perms::{chown_base, options, IfFrom};
317+
<span class="kw">use </span>uucore::perms::{chown_base, options, GidUidOwnerFilter, IfFrom};
301318
<span class="kw">use </span>uucore::{format_usage, help_about, help_usage};
302319

303320
<span class="kw">use </span>uucore::error::{FromIo, UResult, USimpleError};
@@ -311,7 +328,7 @@
311328

312329
<span class="kw">const </span>USAGE: <span class="kw-2">&amp;</span>str = <span class="macro">help_usage!</span>(<span class="string">&quot;chown.md&quot;</span>);
313330

314-
<span class="kw">fn </span>parse_gid_uid_and_filter(matches: <span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;(<span class="prelude-ty">Option</span>&lt;u32&gt;, <span class="prelude-ty">Option</span>&lt;u32&gt;, IfFrom)&gt; {
331+
<span class="kw">fn </span>parse_gid_uid_and_filter(matches: <span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;GidUidOwnerFilter&gt; {
315332
<span class="kw">let </span>filter = <span class="kw">if let </span><span class="prelude-val">Some</span>(spec) = matches.get_one::&lt;String&gt;(options::FROM) {
316333
<span class="kw">match </span>parse_spec(spec, <span class="string">&#39;:&#39;</span>)<span class="question-mark">? </span>{
317334
(<span class="prelude-val">Some</span>(uid), <span class="prelude-val">None</span>) =&gt; IfFrom::User(uid),
@@ -325,17 +342,34 @@
325342

326343
<span class="kw">let </span>dest_uid: <span class="prelude-ty">Option</span>&lt;u32&gt;;
327344
<span class="kw">let </span>dest_gid: <span class="prelude-ty">Option</span>&lt;u32&gt;;
345+
<span class="kw">let </span>raw_owner: String;
328346
<span class="kw">if let </span><span class="prelude-val">Some</span>(file) = matches.get_one::&lt;String&gt;(options::REFERENCE) {
329347
<span class="kw">let </span>meta = fs::metadata(file)
330348
.map_err_context(|| <span class="macro">format!</span>(<span class="string">&quot;failed to get attributes of {}&quot;</span>, file.quote()))<span class="question-mark">?</span>;
331-
dest_gid = <span class="prelude-val">Some</span>(meta.gid());
332-
dest_uid = <span class="prelude-val">Some</span>(meta.uid());
349+
<span class="kw">let </span>gid = meta.gid();
350+
<span class="kw">let </span>uid = meta.uid();
351+
dest_gid = <span class="prelude-val">Some</span>(gid);
352+
dest_uid = <span class="prelude-val">Some</span>(uid);
353+
raw_owner = <span class="macro">format!</span>(
354+
<span class="string">&quot;{}:{}&quot;</span>,
355+
entries::uid2usr(uid).unwrap_or_else(|<span class="kw">_</span>| uid.to_string()),
356+
entries::gid2grp(gid).unwrap_or_else(|<span class="kw">_</span>| gid.to_string())
357+
);
333358
} <span class="kw">else </span>{
334-
<span class="kw">let </span>(u, g) = parse_spec(matches.get_one::&lt;String&gt;(options::ARG_OWNER).unwrap(), <span class="string">&#39;:&#39;</span>)<span class="question-mark">?</span>;
359+
raw_owner = matches
360+
.get_one::&lt;String&gt;(options::ARG_OWNER)
361+
.unwrap()
362+
.into();
363+
<span class="kw">let </span>(u, g) = parse_spec(<span class="kw-2">&amp;</span>raw_owner, <span class="string">&#39;:&#39;</span>)<span class="question-mark">?</span>;
335364
dest_uid = u;
336365
dest_gid = g;
337366
}
338-
<span class="prelude-val">Ok</span>((dest_gid, dest_uid, filter))
367+
<span class="prelude-val">Ok</span>(GidUidOwnerFilter {
368+
dest_gid,
369+
dest_uid,
370+
raw_owner,
371+
filter,
372+
})
339373
}
340374

341375
<span class="attr">#[uucore::main]

dev/src/uucore/features/perms.rs.html

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,28 @@
529529
<a href="#529" id="529">529</a>
530530
<a href="#530" id="530">530</a>
531531
<a href="#531" id="531">531</a>
532+
<a href="#532" id="532">532</a>
533+
<a href="#533" id="533">533</a>
534+
<a href="#534" id="534">534</a>
535+
<a href="#535" id="535">535</a>
536+
<a href="#536" id="536">536</a>
537+
<a href="#537" id="537">537</a>
538+
<a href="#538" id="538">538</a>
539+
<a href="#539" id="539">539</a>
540+
<a href="#540" id="540">540</a>
541+
<a href="#541" id="541">541</a>
542+
<a href="#542" id="542">542</a>
543+
<a href="#543" id="543">543</a>
544+
<a href="#544" id="544">544</a>
545+
<a href="#545" id="545">545</a>
546+
<a href="#546" id="546">546</a>
547+
<a href="#547" id="547">547</a>
548+
<a href="#548" id="548">548</a>
549+
<a href="#549" id="549">549</a>
550+
<a href="#550" id="550">550</a>
551+
<a href="#551" id="551">551</a>
552+
<a href="#552" id="552">552</a>
553+
<a href="#553" id="553">553</a>
532554
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
533555
//
534556
// For the full copyright and license information, please view the LICENSE
@@ -713,7 +735,8 @@
713735
<span class="kw">pub struct </span>ChownExecutor {
714736
<span class="kw">pub </span>dest_uid: <span class="prelude-ty">Option</span>&lt;u32&gt;,
715737
<span class="kw">pub </span>dest_gid: <span class="prelude-ty">Option</span>&lt;u32&gt;,
716-
<span class="kw">pub </span>traverse_symlinks: TraverseSymlinks,
738+
<span class="kw">pub </span>raw_owner: String, <span class="comment">// The owner of the file as input by the user in the command line.
739+
</span><span class="kw">pub </span>traverse_symlinks: TraverseSymlinks,
717740
<span class="kw">pub </span>verbosity: Verbosity,
718741
<span class="kw">pub </span>filter: IfFrom,
719742
<span class="kw">pub </span>files: Vec&lt;String&gt;,
@@ -739,7 +762,16 @@
739762
<span class="kw">let </span>path = root.as_ref();
740763
<span class="kw">let </span>meta = <span class="kw">match </span><span class="self">self</span>.obtain_meta(path, <span class="self">self</span>.dereference) {
741764
<span class="prelude-val">Some</span>(m) =&gt; m,
742-
<span class="kw">_ </span>=&gt; <span class="kw">return </span><span class="number">1</span>,
765+
<span class="kw">_ </span>=&gt; {
766+
<span class="kw">if </span><span class="self">self</span>.verbosity.level == VerbosityLevel::Verbose {
767+
<span class="macro">println!</span>(
768+
<span class="string">&quot;failed to change ownership of {} to {}&quot;</span>,
769+
path.quote(),
770+
<span class="self">self</span>.raw_owner
771+
);
772+
}
773+
<span class="kw">return </span><span class="number">1</span>;
774+
}
743775
};
744776

745777
<span class="comment">// Prohibit only if:
@@ -945,7 +977,13 @@
945977
<span class="kw">pub const </span>ARG_FILES: <span class="kw-2">&amp;</span>str = <span class="string">&quot;FILE&quot;</span>;
946978
}
947979

948-
<span class="kw">type </span>GidUidFilterParser = <span class="kw">fn</span>(<span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;(<span class="prelude-ty">Option</span>&lt;u32&gt;, <span class="prelude-ty">Option</span>&lt;u32&gt;, IfFrom)&gt;;
980+
<span class="kw">pub struct </span>GidUidOwnerFilter {
981+
<span class="kw">pub </span>dest_gid: <span class="prelude-ty">Option</span>&lt;u32&gt;,
982+
<span class="kw">pub </span>dest_uid: <span class="prelude-ty">Option</span>&lt;u32&gt;,
983+
<span class="kw">pub </span>raw_owner: String,
984+
<span class="kw">pub </span>filter: IfFrom,
985+
}
986+
<span class="kw">type </span>GidUidFilterOwnerParser = <span class="kw">fn</span>(<span class="kw-2">&amp;</span>ArgMatches) -&gt; UResult&lt;GidUidOwnerFilter&gt;;
949987

950988
<span class="doccomment">/// Base implementation for `chgrp` and `chown`.
951989
///
@@ -959,7 +997,7 @@
959997
<span class="kw-2">mut </span>command: Command,
960998
args: <span class="kw">impl </span><span class="kw">crate</span>::Args,
961999
add_arg_if_not_reference: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static </span>str,
962-
parse_gid_uid_and_filter: GidUidFilterParser,
1000+
parse_gid_uid_and_filter: GidUidFilterOwnerParser,
9631001
groups_only: bool,
9641002
) -&gt; UResult&lt;()&gt; {
9651003
<span class="kw">let </span>args: Vec&lt;<span class="kw">_</span>&gt; = args.collect();
@@ -1042,12 +1080,18 @@
10421080
} <span class="kw">else </span>{
10431081
VerbosityLevel::Normal
10441082
};
1045-
<span class="kw">let </span>(dest_gid, dest_uid, filter) = parse_gid_uid_and_filter(<span class="kw-2">&amp;</span>matches)<span class="question-mark">?</span>;
1083+
<span class="kw">let </span>GidUidOwnerFilter {
1084+
dest_gid,
1085+
dest_uid,
1086+
raw_owner,
1087+
filter,
1088+
} = parse_gid_uid_and_filter(<span class="kw-2">&amp;</span>matches)<span class="question-mark">?</span>;
10461089

10471090
<span class="kw">let </span>executor = ChownExecutor {
10481091
traverse_symlinks,
10491092
dest_gid,
10501093
dest_uid,
1094+
raw_owner,
10511095
verbosity: Verbosity {
10521096
groups_only,
10531097
level: verbosity_level,

0 commit comments

Comments
 (0)