Skip to content

dird: fix mark command not accepting full windows paths#1938

Merged
BareosBot merged 49 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-mark
Nov 20, 2024
Merged

dird: fix mark command not accepting full windows paths#1938
BareosBot merged 49 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-mark

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Aug 23, 2024

Thank you for contributing to the Bareos Project!

This pr also:

  • fixes StartSocketServer() sometimes misdetecting started server. Caused test issues
  • remove timer_thread.cc and related files. These were completely unused.
  • fixes undefined behaviour in ua_tree (TREE_ROOT is now a subclass of TREE_NODE)
  • changes the return value of mark/unmark command to only report the number of files, whose status was changed
  • fixes hardlink backup/restore on windows
  • fixes some systemtests

and some other general fixes.

TODO:

  • enable restore tests for windows native builds

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@sebsura sebsura added nobuild draft bug This addresses a bug labels Aug 23, 2024
@sebsura sebsura self-assigned this Aug 23, 2024
@sebsura sebsura linked an issue Aug 23, 2024 that may be closed by this pull request
@sebsura
Copy link
Contributor Author

sebsura commented Aug 23, 2024

This should enable the restore tests on windows (as they require this).

@arogge arogge added this to the 24.0.0 milestone Sep 3, 2024
@sebsura
Copy link
Contributor Author

sebsura commented Sep 11, 2024

  • check why you cannot mark files anymore
  • check why hardlinks are restored as directories on windows

@sebsura sebsura removed the nobuild label Oct 9, 2024
@sebsura sebsura marked this pull request as draft October 9, 2024 08:23
@sebsura sebsura force-pushed the dev/ssura/master/fix-mark branch 3 times, most recently from cbafa1b to 578bd47 Compare October 10, 2024 11:59
@sebsura sebsura force-pushed the dev/ssura/master/fix-mark branch from 48ca4b3 to 0737d15 Compare October 23, 2024 12:21
@sebsura sebsura removed the draft label Oct 24, 2024
@sebsura sebsura force-pushed the dev/ssura/master/fix-mark branch 4 times, most recently from 236b7dc to 856972e Compare October 25, 2024 09:51
@sebsura sebsura marked this pull request as ready for review November 6, 2024 08:05
@sebsura sebsura requested a review from pstorz November 6, 2024 08:05
@sebsura sebsura force-pushed the dev/ssura/master/fix-mark branch from c29c45d to c799857 Compare November 14, 2024 13:10
sebsura and others added 28 commits November 20, 2024 20:02
Both device_initialisation as well as the main stored function try to
init the jcr chain at the same time.  Sadly only device_initialisation
takes the lock, meaning that sometimes a race happens and the sd
crashes (notices on a test run).
On our build infrastructure (using cygwin) we get this uname:
CYGWIN_NT-10.0-20348
So we need to check a bit more carefully
Now that windows supports hardlinks, we need to add them back to the
count, as they are not deleted in setup_data anymore.
Previously the iteration order depended on the c++ lib
implementation (and could also be change from run to run).  This lead
to issues where 'show job' would print jobs on linux but jobdefs on
windows.

To make sure that always the same element is chosen, we need to make
sure the order is always the same.  This is easily done by just using
a vector here.
Its important that error messages output what bareos thinks and not
what the user inputed (as the user knows that himself).

This caused a weird issue on windows when 'show job=<jobname>' was
interpreted as 'show jobdefs=<jobname>' which returned the error

job resource <jobname> not found.

Which is extremely misleading, as bareos never searched for a job in
that case.  If the error message would have been instead

jobdefs resource <jobname> not found.

then the user at least notices that bareos did something wrong and try
some other input instead of trying to understand why the job was not
found.
We replace /dev/null with a variable so that we can use NUL on windows
instead!
dangling-link does not get created on windows, so we need to chose a
different file.
You cannot set test properties on tests that do not exist.  Subtests
dont exist if you disable the main test, so this was leading to
configuration errors on windows.
This test requires a shell script + flock to function correctly.
This test runs multiple backups and, since vss takes a long time to
setup, runs into timeouts.  As such we disable VSS for this test.
Our fix for invalid paths messed up our handling for relative paths as
'.' was treated as an invalid character and was replaced.  This caused
the '.' that glob() generated to end up in an absolute path, which was
is not valid.

We can now also reenable the parser test as this was the only reason
that it did not work.
The old code did not handle ./.. correctly, so we should not try to
emulate that.
The long_file_name was not setup correctly, so I fixed that and added
a test that checked the previously checked behaviour.
@BareosBot BareosBot force-pushed the dev/ssura/master/fix-mark branch from 4dbe6e1 to bf88e3f Compare November 20, 2024 20:02
@BareosBot BareosBot merged commit 1262405 into bareos:master Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This addresses a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mark command does not accept full path on windows

4 participants