Code Monkey home page Code Monkey logo

libtrash's People

Contributors

andteki avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

libtrash's Issues

tar -x fails with libtrash on some archives; wrongly creates mode 000 extracts

it appeared to me with https://github.com/openwrt/openwrt/archive/v17.01.4.tar.gz
(sha256sum v17.01.4.tar.gz: a833a0c1c212209fdb6717ee943b0d8c6ce60a33c6e2792e6b59302387c69b44 v17.01.4.tar.gz)

When I extract it with LIBTRASH preloaded (and I am not in a directory
which is listed at TEMPORARY_DIRS or somewhere else in ~/.libtrash):

tar -xvzf v17.01.4.tar.gz

at the end I sometimes get the error

tar: openwrt-17.01.4/target/linux/layerscape/32b/profiles/00-default.mk: Cannot unlink: Permission denied
tar: openwrt-17.01.4/package/base-files/files/etc/os-release: Cannot unlink: Permission denied
tar: Exiting with failure status due to previous errors

and sometimes the error

tar: Exiting with failure status due to previous errors

(Always one of those two).

If I look at the files openwrt-17.01.4/target/linux/layerscape/32b/profiles/00-default.mk and openwrt-17.01.4/package/base-files/files/etc/os-release, they have permission 000 (i.e. no read, write or execute permission for user, for group and for all).

The complete output of

tar -xvzf v17.01.4.tar.gz 2>&1 | tee logfile

is here: error-variant 1 (size: ca. 612 kB), error-variant 2 (size: ca. 612 kB).

I have also attached the output of

strace tar -xvzf v17.01.4.tar.gz 2>&1 | tee logfile

(for the second error variant): here (size: ca. 4.5 MB).

When I extract it with

TRASH_OFF=YES tar -xvzf v17.01.4.tar.gz

or with

LD_PRELOAD='' tar -xvzf v17.01.4.tar.gz

everything works fine.

Error also happens if I

gunzip v17.01.4.tar.gz

first and then just

tar -xvf v17.01.4.tar

Attached you also find my current ~/.libtrash:
here (size: ca. 18 kB)

Note: My ~/.libtrash is a symlink to a system-wide libtrash config file
I use for all users.

Libtrash on network by AFP (Netatalk)

I am trying to use libtrash to delete the files via afp, I noticed that this version does not have the netatalk file in init.d

Has anyone used trash over network?

libtrash alters mode of files saved by LyX to 240.

Recently, additionally to the bug of chrome and vivaldi browsers not
showing up any window if libtrash is preloaded, there are issues with
LyX in the current version of LyX:

If LyX is started with libtrash preloaded, and I open an already
existing file, and then safe it, the permissions are changed: It gets
write permission for the user and read permission for the group but NOT
THE USER (mode 240).

Meaning, usually, the user cannot read the file anymore.

Since lyx uses some default .lyx-file at startup when creating a new
document, copying it over to a temporary file, it cannot read that file
anymore, thus it is impossible to start a new document.

Attached are two screenshots of dialogues showing up if I want to
create a new document with LyX. The second dialogue comes up when I
close the first one.

The file ~/.lyx/templates/defaults.lyx has "usual" permissions (644),
but the /tmp/lyx_tmpdir.PuDcxaWoEgGU/Buffer_convertLyXFormatmVnNfa.lyx,
which is a file created transiently by LyX from
~/.lyx/templates/defaults.lyx has mode 240, making LyX unable to read
it and fail (and thus LyX thinks that ~/.lyx/templates/defaults.lyx is
not readable, since LyX does not expect that file permissions differ
from what LyX wants them to be).

Starting lyx with an empty LD_PRELOAD mitigates this problems.

Can you have a look into it? Are you sure that this is not a problem
with libtrash?

Output of lyx --version:
LyX 2.2.3 (2017-05-17)
Configuration
Host type: x86_64-unknown-linux-gnu
Special build flags: build=release c++11 std-regex use-aspell use-enchant use-hunspell
C++ Compiler: g++ (7.2.1)
C++ Compiler flags: -std=c++11 -fPIC -O2 -Wno-deprecated-declarations
C++ Compiler user flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fpermissive
Linker flags:
Linker user flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
Qt Frontend:
Qt version: 5.10.0
Packaging: posix
LyX binary dir: /usr/bin
LyX files dir: /usr/share/lyx

libtrash version: 3.3

lyx-01-create-new
lyx-02-create-new

kate creates wrong file permissions (240) with libtrash.

I use:

  • kate --version: kate 17.12.3,
  • Operating system: Arch/ Artix Linux, x86_64,
  • Environment (output of env): env.txt,
  • libtrash version 3.3 (Arch Linux package libtrash 3.3-4 from AUR,
  • This ~/.libtrash: .libtrash.txt, which I installed as a symlink to /etc/libtrash.conf which again is a symlink to /usr/local/etc/libtrash.conf. (I deliberately did choose to do so to have same config for all users; it is my machine and not a multi user machine.)

I run

kate -n textfile.txt

(textfile.txt does not exist yet), write a line (I write 1st edit, followed by a newline), and save.

Output of ls -l textfile.txt:

--w-r----- 1 felics felics 9 Mar 11 11:45 textfile.txt

(Mode is 240, but it shout be 644.)

I write a second line (I write 2nd edit, followed by a newline) in kate, and save.

Now I see a temporary file in the directory:

--w-r----- 1 felics felics   18 Mar 11 11:48 textfile.txt.LrTBro

As well as the usual crash-recovery .kate-swp file:

-rw------- 1 felics felics  291 Mar 11 11:48 .textfile.txt.kate-swp

which has interestingly permissions as they should be, and kate displays the attached error message:
kate-libtrash_save_error

The temporary file textfile.txt.LrTBro has the content I wanted to save, while the textfile.txt did stay unchanged. I assume that kate saves to the temporary file first if the target file already exists and then tries to "move to the new file" (maybe by renaming), which fails (seems to be related to libtrash trying to save to ~/.Trash what kate would overwrite, see below).

When exiting kate without saving, the .textfile.txt.kate-swp gets correctly removed, but the temporary file stays.

I attach the output of

kate -n textfile.txt 2>&1 | tee kate_with_lintrash.log

(kate_with_lintrash.log.txt)

and

strace kate -n textfile.txt 2>&1 | tee kate_strace_with_lintrash.log

(kate_strace_with_lintrash.log.txt.gz),

both were started over with removed textfile.txt.

(The 'kate_strace_with_lintrash.log' I attached gzip-compressed due to it's uncompressed size of about 3.8 MB, and I gave them the extension .txt due to github's restrictions on file extensions.)

With

TRASH_OFF=YES kate -n textfile.txt

the second save works fine, but the created file also get's wrong permissions:

--w-r----- 1 felics felics 18 Mar 11 12:01 textfile.txt

(It seems to me that the failure in resaves is that libtrash fails to move something to ~/.Trash/).

With

LD_PRELOAD='' kate -n textfile.txt

everything is fine and the created file has correct permissions:

-rw-r--r-- 1 felics felics 18 Mar 11 12:04 textfile.txt

Also I attach textfile.txt as it should be after two successful saves: textfile.txt.

When I open with kate a file that is already existing, the permissions stay as they are.

Similar things also happen with LyX 2.2.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.