Bug 436439 - plasma-workspace 93f9ef030 broke my autostart scripts -- repeating the conversion
Summary: plasma-workspace 93f9ef030 broke my autostart scripts -- repeating the conver...
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: Other Other
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-01 06:35 UTC by Duncan
Modified: 2021-09-30 04:35 UTC (History)
6 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 Duncan 2021-05-01 06:35:12 UTC
... and what's worse, reverting to before it didn't fix them again as the conversion had already broken them.  Thus, despite my finding that commit in the log relatively quickly and believing it to be the culprit, because reverting to before it didn't fix things, it took me hours to figure out what had happened.

There's actually two bugs.  This is the second one (the first is bug #436437)

Apparently the converter does another conversion of the now *.desktop files each time I restart kde/plasma, so after a few restarts I end up with...

whatever.desktop
whatever.desktop.desktop
whatever.desktop.desktop.desktop
whatever.desktop.desktop.desktop.desktop
...
foo.desktop
foo.desktop.desktop
foo.desktop.desktop.desktop
foo.desktop.desktop.desktop.desktop
...
bar.desktop
bar.desktop.desktop
bar.desktop.desktop.desktop
bar.desktop.desktop.desktop.desktop
...

Furthermore, the files are duplicated in both the autostart and the autostart-scripts dirs (plus the old-autostart-scripts dir but it only has a single copy of each file, with a single .desktop extension).

I had apparently restarted 10 times trying to trace down the first of the two bugs, with 9 original autostart scripts as by the time I caught it I marked and deleted 90 files in each of the two subdirs to get rid of the dupes (I was using mc so it gave me a count of the files to delete in the delete-confirmation).  After I fix the damage from the first bug I guess I'll try setting the dirs readonly and see if that prevents the dupe-creation.
Comment 1 Nate Graham 2021-05-03 19:51:05 UTC
Did you restart after applying that commit? This happened to me too while testing, but after restarting, everything was all better. This is what users would (presumably, hopefully) do after a system upgrade.
Comment 2 Duncan 2021-05-04 02:48:10 UTC
(In reply to Nate Graham from comment #1)
> Did you restart after applying that commit? 

Thanks for the review.

Yes I restarted.  Multiple times in fact.  That's how I ended up with 11 copies of each of the scripts (and deleted 10 leaving one) in each of the two dirs (plus the single copy in the old-autostart-scripts backup dir) before I finally figured out what was going on. =:^(  If I hadn't restarted multiple times there would have only been the one extra copy, not ten extra copies.

Thus the "each time I restart" and "after a few restarts" in the original description. =:^)

As for the workaround, setting the dir read-only, with autostart-scripts actually being a symlink to autostart to avoid having two dirs plus the backup with the same content, seems to have been effective.  Further restarts haven't produced more copies again.  =:^)

(I was afraid I was going to have to either set immutable, or worse, add a section to my kde launcher script that deleted the autostart dir and copied it from the backup, like I had to do with konsolerc in a konsole wrapper script for bug #430036 because konsole protests if konsolerc is set readonly or set immutable.  But in this case read-only seems to have had the intended effect without further side-effects.)
Comment 3 hchain 2021-05-04 09:29:27 UTC
Are you sure you didn't have autostart and autostart-scripts symlinked before ? I don't see how whatever.desktop.desktop.desktop could happen otherwise (autostart should only contain .desktop files, and autostart-scripts, which is the only one looked at by the migration, should only contain scripts).

What's more, the migration does attempt to avoid running more than once, by either deleting the autostart-scripts directory if it is empty after the migration, or renaming it to old-autostart-scripts if there are still files inside.

Could the renaming have failed on your machine ? perhaps due to a permission issue ?

It looks to me like the multiple copies happened as a result of your trying to fix the other issue (with the argv[0] being different since the move to .desktop files)
Comment 4 Duncan 2021-05-04 10:54:05 UTC
(In reply to hchain from comment #3)
> Are you sure you didn't have autostart and autostart-scripts symlinked
> before ?

Excellent question I'd be asking a reporter as well, but yes, I'm sure they weren't symlinked before as I both knew/used the distinction (preferring symlinks to scripts in the scripts dir to *.desktop files in the non-scripts dir, FWIW), and specifically symlinked the dir *after* the conversion when I noticed it was treating them the same.

> I don't see how whatever.desktop.desktop.desktop could happen
> otherwise (autostart should only contain .desktop files, and
> autostart-scripts, which is the only one looked at by the migration, should
> only contain scripts).

Well, it happened.  There's gotta be something going wrong with the logic, somewhere...

> What's more, the migration does attempt to avoid running more than once, by
> either deleting the autostart-scripts directory if it is empty after the
> migration, or renaming it to old-autostart-scripts if there are still files
> inside.
>  
> Could the renaming have failed on your machine ? perhaps due to a permission
> issue ?

It did do the rename to old-autostart-scripts here.  I have that dir with exactly one file for each of the original scripts (and it wasn't there before the conversion).  So that part of the script seems to be working.  It's gotta be screwing up elsewhere.
Comment 5 Duncan 2021-05-06 12:45:50 UTC
(In reply to hchain from comment #3)
> What's more, the migration does attempt to avoid running more than once, by
> either deleting the autostart-scripts directory if it is empty after the
> migration, or renaming it to old-autostart-scripts if there are still files
> inside.
> 
> Could the renaming have failed on your machine ? perhaps due to a permission
> issue ?

So I've been looking at the code and trying to figure out what happened, not exactly easy for someone far more comfortable in bash than C++, tho I can sort of read it and even occasionally patch it successfully if I stare at it for long enough...

What do I do to turn on the qCInfo/qCDebug output?  Because I have a theory or two I'd like to test, and a backup copy of my old autostart and autostart-scripts dirs I can copy back in place to test with.

The best theory is a followup on that permissions issue remark.  My GUI-user owned both dirs, which had 0750 permissions while the config parent had 0o0700 perms.  All files in the autostart-scripts dir were symlinks and the target was obviously readable (perms 0o0740 FWIW) or they'd have not been executing previously.

But the symlinks were all root owned.[1]  Of course that shouldn't matter unless the dirs are set sticky (they weren't, 0o0750 perms not 0o1750).  But if something aborted on root ownership even if it shouldn't matter for symlinks...

So I'd like to do a trial run using the files and perms from my backups, with that qCInfo/qCDebug stuff turned on, maybe even adding a couple more debug lines, and see what comes out.  But to do that I need to know how to turn it on and where to look for the output...

---
[1] I could have sworn that back in the day, kernel 2.4/2.6 kde2/3 era, all my symlinks were root owned.  Maybe reiserfs handled them that way or 2.4 in general did??  But I can't seem to find anything to back that up and I've looked, so maybe it was just my being new to *ix back then.  In any case current btrfs lets non-root own symlinks.  But I remember stopping short when I first noticed them and wondering what had changed.
Comment 6 Nate Graham 2021-08-31 18:22:43 UTC
Do you happen to have a reproducible way to trigger this? Because we can't find any fault in the logic, and if you can't make it happen again, it's unlikely this will be debuggable. :(
Comment 7 Bug Janitor Service 2021-09-15 04:36:13 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Bug Janitor Service 2021-09-30 04:35:53 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!