Bug 380881 - Bash interprets COMMAND {folder}/.* as COMMAND {folder}/..
Summary: Bash interprets COMMAND {folder}/.* as COMMAND {folder}/..
Status: RESOLVED NOT A BUG
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 17.04.0
Platform: Neon Linux
: NOR major
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-06 09:31 UTC by dk
Modified: 2017-06-17 12:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dk 2017-06-06 09:31:42 UTC
This is my very first bug entry. Maybe this is normal behavior. But I never
saw this on other Linux machines before (Trusty 14.04 for instance).
Please ask back if something is unclear.

I wanted to chown hidden files in a subdirectory with
chown {user}:{group} -R {folder}/.*

The result was, that all folders and subfolders in . have been touched too.

Same happens with rm -R {folder}/.*. But removing was refused because I
was in ./

That means, {folder}/.* is interpreted also as {folder}/..

Please try:
cd /tmp
mkdir test
mkdir test/test
mkdir test/test/folder1
mkdir test/test/folder2
touch test/test/.hiddenfile
touch test/test/folder1/.hiddenfile1
touch test/test/folder2/.hiddenfile2

cd test
pwd
/tmp/test/test
ls -lath /tmp/test/test
drwxrwxr-x 2 test test 4,0K Jun  6 11:05 folder2
drwxrwxr-x 4 test test 4,0K Jun  6 11:05 .
drwxrwxr-x 2 test test 4,0K Jun  6 11:05 folder1
-rw-rw-r-- 1 test test    0 Jun  6 11:05 .hiddenfile
drwxr-xr-x 3 test test 4,0K Jun  6 11:04 ..


# change folder1 and subfolders to testgroup
chown test:testgroup -R folder1/
ls -lath
drwxrwxr-x 2 test test      4,0K Jun  6 11:05 folder2
drwxrwxr-x 4 test test      4,0K Jun  6 11:05 .
drwxrwxr-x 2 test testgroup 4,0K Jun  6 11:05 folder1
-rw-rw-r-- 1 test test         0 Jun  6 11:05 .hiddenfile
drwxr-xr-x 3 test test      4,0K Jun  6 11:04 ..


# change folder1 and subfolders to testgroup
ls -lath folder1/
drwxrwxr-x 2 test testgroup 4,0K Jun  6 11:05 .
drwxrwxr-x 4 test test      4,0K Jun  6 11:05 ..
-rw-rw-r-- 1 test testgroup    0 Jun  6 11:05 .hiddenfile1


# change folder1 and hidden files to testgroup
chown test:testgroup -R folder1/.*
drwxrwxr-x 2 test testgroup 4,0K Jun  6 11:05 folder2
drwxrwxr-x 4 test testgroup 4,0K Jun  6 11:05 .
drwxrwxr-x 2 test testgroup 4,0K Jun  6 11:05 folder1
-rw-rw-r-- 1 test testgroup    0 Jun  6 11:05 .hiddenfile
drwxr-xr-x 3 test test      4,0K Jun  6 11:04 ..



# Removing subfolders
alias rm='rm -i'     # This asks to remove ../
rm -R folder1/.*
rm: refusing to remove '.' or '..' directory: skipping 'folder1/.'
rm: refusing to remove '.' or '..' directory: skipping 'folder1/..'
rm: remove regular empty file 'folder1/.hiddenfile1'? n



As the KDE Neon Dev stable installation is a test installation I cannot
guarantee that I'll have this system still installed when you answer me.
The history should be reproducible.

The installation is a fresh install with a low latency kernel, five or siy small packages from KXStudio repo installed and with upgraded packages.

ISO: neon-devedition-gitstable-20170605-1854-amd64.iso
Comment 1 Egmont Koblinger 2017-06-11 17:31:46 UTC
> That means, {folder}/.* is interpreted also as {folder}/..

This is intentional and as far as I remember has always been the case. I have no clue why it didn't work like this for you in Trusty.

Anyway, please search the Internet for "what's the difference between terminal emulator and shell" to learn and understand why your observation has absolutely nothing to with konsole or kde, thanks!
Comment 2 Kurt Hindenburg 2017-06-17 12:45:06 UTC
I don't believe this is related to KDE or Konsole