Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving issue #2541 #2735

Merged
merged 19 commits into from Jun 12, 2019
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions doc/INSTALL.md
Expand Up @@ -101,11 +101,17 @@ brew install elektra

. We also provide a tap containing a more elaborate formula [here](http://github.com/ElektraInitiative/homebrew-elektra).

## Generic
## Windows

Please refer to the section OS independent below.

## OS independent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## OS independent
## OS Independent

Please use title-case for headers.


First follow the steps in [COMPILE](COMPILE.md).

To install Elektra use:
After you completed building Elektra on your own, there are multiple options how to install it. For example, with make or cPack tools.

### make

```sh
sudo make install
Expand All @@ -126,7 +132,7 @@ or in the build directory (will not honor `DESTDIR`!):
xargs rm < install_manifest.txt
```

## CPack
### CPack

First follow the steps in [COMPILE](COMPILE.md).

Expand Down
8 changes: 8 additions & 0 deletions doc/news/_preparation_next_release.md
Expand Up @@ -367,6 +367,14 @@ removed due to:
- New plugin to validate hex formatted colors (e.g. #fff or #abcd) and normalize them to rgba (4294967295 (= 0xffffffff) and 2864434397 (= 0xaabbccdd) respectively). It also has support for named colors according to the [extended color keywords](https://www.w3.org/TR/css-color-3/#svg-color) from CSS3.
_(Philipp Gackstatter)_

### Ini

- new formatting is introduced --> instead of having whitespaces around '=' now the whitespaces are not allowed anymore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespaces should be allowed (it would be an incompatible change to disallow it) but the INI plugin should not write out these whitespaces anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markus2330 Thank you for your comment.
Well, the problem is that I started working on this issue since months and nobody has told me the whitespaces should be allowed. I had another pull request where I pushed my changes I think at the beginning of April. These changes clearly showed that the whitespaces will not be allowed anymore. It would've saved me a lot of time since I hadn't had to fix all those tests due to different formatting. Now I have to reimplement it, probably again fix the tests, etc. I am very much disappointed...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry for the confusion but #2065 clearly says that something additional should be supported and it does not mention that previous working files should be rejected.

I do not think you need to rewrite all tests, nor that your changes are useless. In all tests where the INI file is written you obviously need to remove the spaces, otherwise the files would not be identical after writing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markus2330
So, after spending many many hours, this is my outcome:

  1. Reading is possible both with and without spaces. The example below will not cause any problems:
one=1
two = 2
  1. Writing is only done without spaces -- if a file had mixed approaches like
one=1
two = 2

after writing for example --

set user/test/three 3

the result would be

one=1
two=2
three=3

Do you confirm this kind of behaviour is what it should be?

@markus2330 Can you please reward my group colleague @e01306821 with some extra points for the class? He provided me support multiple times and deserves nothing less than a "1" in my opinion. Sorry for the off-topic. =)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you confirm this kind of behaviour is what it should be?

Yes, perfect. This should fix #2541.

Can you please reward my group colleague @e01306821 with some extra points for the class?

Yes. Please try to reflect what you learned in the tutorials/docu.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will! Thank you very much!

example of old formatting: key1 = value1
example of new formatting: key1=value1

. _(Oleksandr Shabelnyk)_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation of your name (exactly two spaces before the dot). Otherwise your name will show up in code style:

Release

. If you want to know why that is the case, please take a look at the Markdown specification.


## Libraries

The text below summarizes updates to the [C (and C++)-based libraries](https://www.libelektra.org/libraries/readme) of Elektra.
Expand Down
12 changes: 6 additions & 6 deletions doc/tutorials/validation.md
Expand Up @@ -226,14 +226,14 @@ the human readable [ni format](/src/plugins/ni/README.md) by using `kdb import`)
sudo kdb mount tutorial.dump spec/tests/tutorial dump
cat << HERE | kdb import spec/tests/tutorial ni \
[] \
mountpoint = tutorial.dump \
infos/plugins = dump validation \
mountpoint=tutorial.dump \
infos/plugins=dump validation \
\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also remove two whitespaces in line 231 and 232 to keep the formatting consistent.

[/links/_] \
check/validation = https?://.*\..* \
check/validation/match = LINE \
check/validation/message = not a valid URL \
description = A link to some website \
check/validation=https?://.*\..* \
check/validation/match=LINE \
check/validation/message=not a valid URL \
description=A link to some website \
HERE
kdb lsmeta spec/tests/tutorial
#> infos/plugins
Expand Down
Empty file modified scripts/run_dev_env 100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions src/plugins/base64/README.md
Expand Up @@ -74,7 +74,7 @@ kdb get user/tests/base64/binary

# The value inside the configuration file is encoded by the Base64 plugin
kdb file user/tests/base64 | xargs cat
# STDOUT-REGEX: binary = "@BASE64[a-zA-Z0-9+/]+={0,2}"
# STDOUT-REGEX: binary="@BASE64[a-zA-Z0-9+/]+={0,2}"

# Undo modifications
kdb rm -r user/tests/base64
Expand Down Expand Up @@ -114,7 +114,7 @@ kdb mount config.ini user/tests/base64 ini base64 binary/meta=
# Save base64 encoded data `"value"` (`0x76616c7565`)
kdb set user/tests/base64/encoded dmFsdWUA
kdb file user/tests/base64/encoded | xargs cat | grep encoded
#> encoded = dmFsdWUA
#> encoded=dmFsdWUA

# Tell Base64 plugin to decode and encode key value
kdb setmeta user/tests/base64/encoded type binary
Expand Down
18 changes: 9 additions & 9 deletions src/plugins/blockresolver/README.md
Expand Up @@ -44,9 +44,9 @@ echo 'more text' >> $(kdb get system/tests/blockfile)
echo 'some more text' >> $(kdb get system/tests/blockfile)
echo '>>> block config start' >> $(kdb get system/tests/blockfile)
echo '[section1]' >> $(kdb get system/tests/blockfile)
echo 'key1 = val1' >> $(kdb get system/tests/blockfile)
echo 'key1=val1' >> $(kdb get system/tests/blockfile)
echo '[section2]' >> $(kdb get system/tests/blockfile)
echo 'key2 = val2' >> $(kdb get system/tests/blockfile)
echo 'key2=val2' >> $(kdb get system/tests/blockfile)
echo '>>> block config stop' >> $(kdb get system/tests/blockfile)
echo 'text again' >> $(kdb get system/tests/blockfile)
echo 'and more text' >> $(kdb get system/tests/blockfile)
Expand All @@ -61,9 +61,9 @@ cat $(kdb get system/tests/blockfile)
#> some more text
#> >>> block config start
#> [section1]
#> key1 = val1
#> key1=val1
#> [section2]
#> key2 = val2
#> key2=val2
#> >>> block config stop
#> text again
#> and more text
Expand All @@ -72,9 +72,9 @@ cat $(kdb get system/tests/blockfile)
# only the block between the tags is read!
kdb export system/tests/blockresolver ini
#> [section1]
#> key1 = val1
#> key1=val1
#> [section2]
#> key2 = val2
#> key2=val2

# add a new key to the resolved block
kdb set system/tests/blockresolver/section1/key12 val12
Expand All @@ -85,10 +85,10 @@ cat $(kdb get system/tests/blockfile)
#> some more text
#> >>> block config start
#> [section1]
#> key1 = val1
#> key12 = val12
#> key1=val1
#> key12=val12
#> [section2]
#> key2 = val2
#> key2=val2
#> >>> block config stop
#> text again
#> and more text
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/blockresolver/blockresolver/compare.block
@@ -1,8 +1,8 @@
[section]
key = outside start
key=outside start
### block config start
[section]
key = only the inside has changed
key=only the inside has changed
### block config stop
[section]
key = outside end
key=outside end
6 changes: 3 additions & 3 deletions src/plugins/blockresolver/blockresolver/test.block
@@ -1,8 +1,8 @@
[section]
key = outside start
key=outside start
### block config start
[section]
key = inside block
key=inside block
### block config stop
[section]
key = outside end
key=outside end
14 changes: 7 additions & 7 deletions src/plugins/conditionals/README.md
Expand Up @@ -112,17 +112,17 @@ sudo kdb mount sub.ini /tests/conditionals/sub ini
sudo kdb global-mount conditionals || $(exit 0)

# create testfiles
echo 'key1 = val1' > `kdb file /tests/conditionals`
echo 'key1=val1' > `kdb file /tests/conditionals`
echo '[key1]' >> `kdb file /tests/conditionals`
echo "check/condition = (./ == 'val1') ? (../sub/key == 'true')" >> `kdb file /tests/conditionals`
echo "check/condition=(./ == 'val1') ? (../sub/key == 'true')" >> `kdb file /tests/conditionals`

echo "key = false" > `kdb file /tests/conditionals/sub`
echo "key=false" > `kdb file /tests/conditionals/sub`

# should fail and yield an error
kdb export /tests/conditionals ini
#> sub/key = false
#> sub/key=false
#> #@META check/condition = (./ == 'val1') ? (../sub/key == 'true')
#> key1 = val1
#> key1=val1
# ERROR:135
# Error (#135) occurred!
# Description: Validation failed
Expand All @@ -136,9 +136,9 @@ kdb set /tests/conditionals/sub/key true

# should succeed
kdb export /tests/conditionals ini
#> sub/key = true
#> sub/key=true
#> #@META check/condition = (./ == 'val1') ? (../sub/key == 'true')
#> key1 = val1
#> key1=val1

# cleanup
kdb rm -r /tests/conditionals
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/curlget/README.md
Expand Up @@ -108,8 +108,8 @@ stat /tmp/curltest.ini
# RET:0
cat /tmp/curltest.ini
#> [section1]
#> key1 = val1
#> key2 = val2
#> key1=val1
#> key2=val2
rm /tmp/curltest.ini || $(exit 0)
sudo kdb mount -R curlget -c url/put="http://127.0.0.1:8000",user="thomas",password="pass",upload/method="POST",upload/postfield="file" "http://127.0.0.1:8000/curltest.ini" system/curl ini
kdb ls system/curl
Expand All @@ -126,7 +126,7 @@ kdb rm system/curl/section1/key2
sudo kdb umount system/curl
cat /tmp/httproot/curltest.ini
#> [section1]
#> key1 = val1
#> key1=val1
```

### Mount with HTTP GET + POST and keep local copy
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/iconv/iconv/iconv.ini
@@ -1 +1 @@
a = hell�
a=hell�
53 changes: 27 additions & 26 deletions src/plugins/ini/README.md
Expand Up @@ -11,8 +11,9 @@

## Introduction

[lock/a/lock]
This plugin allows Elektra's users to read and write INI files.
INI files consist of simple key value pairs of the form `key = value`.
INI files consist of simple key value pairs of the form `key=value`.
Additionally keys can be categorized into different sections.
Sections must be enclosed in "[]", for example "[section]".
Each section is converted into a directory key
Expand Down Expand Up @@ -71,8 +72,8 @@ have to start with whitespace characters.
For example consider the following ini file:

```ini
key1 = value1
key2 = value2
key1=value1
key2=value2
with continuation
lines
```
Expand All @@ -91,10 +92,10 @@ For example an ini file looking like:

```ini
[sec]
a = 1
a = 2
a = 3
a = 4
a=1
a=2
a=3
a=4
```

will be interpreted as
Expand Down Expand Up @@ -132,9 +133,9 @@ kdb get user/tests/ini/songs/#2

# Check the file written by the INI plugin
kdb file user/tests/ini | xargs cat
#> songs = Non-Zero Possibility
#> songs = Black Art Number One
#> songs = A Story Of Two Convicts
#> songs=Non-Zero Possibility
#> songs=Black Art Number One
#> songs=A Story Of Two Convicts

# Undo modifications
kdb rm -r user/tests/ini
Expand All @@ -152,7 +153,7 @@ By default the INI plugin does not support binary data. You can use the [Base64
sudo kdb mount --with-recommends config.ini user/tests/ini ini base64

# Add empty binary value
printf 'nothing = "@BASE64"\n' > `kdb file user/tests/ini`
printf 'nothing="@BASE64"\n' > `kdb file user/tests/ini`
# Copy binary data
kdb cp system/elektra/modules/ini/exports/get user/tests/ini/binary
# Add textual data
Expand Down Expand Up @@ -190,7 +191,7 @@ kdb setmeta user/tests/ini/brand rationale "Because I Love It"
kdb file user/tests/ini | xargs cat
#> #@META description = The Devil And God Are Raging Inside Me
#> #@META rationale = Because I Love It
#> brand = new
#> brand=new

# Retrieve metadata
kdb lsmeta user/tests/ini/brand | grep -v 'internal'
Expand Down Expand Up @@ -226,7 +227,7 @@ kdb set dir/tests/a/b ab
kdb get dir/tests/a # <-- key is suddenly here
cat empty.ini
#> [a]
#> b = ab
#> b=ab

# Undo modifications
kdb rm -r dir/tests
Expand All @@ -242,13 +243,13 @@ kdb set dir/tests/a/b ab
kdb get dir/tests/a # no key here
# RET: 11
cat empty.ini
#> a/b = ab
#> a/b=ab
kdb rm dir/tests/a/b
kdb set dir/tests/a # create section first
kdb set dir/tests/a/b ab
cat empty.ini
#> [a]
#> b = ab
#> b=ab

# Undo modifications
kdb rm -r dir/tests
Expand All @@ -272,28 +273,28 @@ sudo kdb mount test.ini /tests/ini ini

cat > `kdb file /tests/ini` <<EOF \
[Section1]\
key1 = val1\
key1=val1\
[Section3]\
key3 = val3\
key3=val3\
EOF

kdb file /tests/ini | xargs cat
#> [Section1]
#> key1 = val1
#> key1=val1
#> [Section3]
#> key3 = val3
#> key3=val3

kdb set /tests/ini/Section1/Subsection1/subkey1 subval1
kdb set /tests/ini/Section2/key2 val2
kdb file /tests/ini | xargs cat
#> [Section1]
#> key1 = val1
#> key1=val1
#> [Section1/Subsection1]
#> subkey1 = subval1
#> subkey1=subval1
#> [Section2]
#> key2 = val2
#> key2=val2
#> [Section3]
#> key3 = val3
#> key3=val3

# Undo modifications
kdb rm -r /tests/ini
Expand All @@ -308,14 +309,14 @@ The INI plugin also supports values and keys containing delimiter characters (`=
sudo kdb mount test.ini user/tests/ini ini

printf '[section1]\n' > `kdb file user/tests/ini`
printf 'hello = world\n' >> `kdb file user/tests/ini`
printf 'hello=world\n' >> `kdb file user/tests/ini`

kdb get user/tests/ini/section1/hello
#> world

kdb set user/tests/ini/section1/x=x 'a + b = b + a'
kdb set user/tests/ini/section1/x=x 'a + b=b + a'
kdb get user/tests/ini/section1/x=x
#> a + b = b + a
#> a + b=b + a

# Undo modifications
kdb rm -r user/tests/ini
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/ini/crash_test/crash001.ini
@@ -1,2 +1,2 @@
"value = long
"value=long
key