summaryrefslogtreecommitdiff
path: root/TODOs.md
blob: 975f1b39a990f6e0d6e32d966fa006bf1ee184d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# Tasks

## TODO `test_mkdir_p()` is generating randon directories in `$PWD` instead of `/tmp` {#task-bd165b74-c559-48ee-1d29-eaa906aa0393}
- TODO in 2021-06-27

## TODO `assert-manpages.sh`: ensure that `$(manpages)` contain everything from `$(manpages.en)` {#task-20f96d7d-2fd8-7a5f-e861-ded565c3b408}
- TODO in 2021-06-27

## TODO `malloc` vs `calloc` {#task-b3261473-9d12-9df4-cbfe-c4017ffed709}
- TODO in 2021-06-27

## TODO Document `EXIT_STATUS` in manpage for `remembering.1` {#task-013534fe-8839-9de1-ec4a-9d63980fc096}
- TODO in 2021-06-27

## TODO Use `strtok(3)` over manually separating strings {#task-44843686-1328-521a-8281-60dbb05f2d3f}
- TODO in 2021-06-22

## TODO Translate usage/help and manpages {#task-47d98f68-0dec-f9b2-4d5c-bfe822411477}
- TODO in 2021-06-16

---

Started at
[`a79ced6f0925526ab41ecbdb9e6e8cac86f8ea75`](https://git.euandreh.xyz/remembering/commit/?id=a79ced6f0925526ab41ecbdb9e6e8cac86f8ea75).

## DONE Also use inline monospaced font in manpages {#task-f1b27444-f824-353e-6e89-63974dcce550}
- DONE in 2021-06-14

  TIL: use `\fC` (C for "constant-width") for inlined monospace text, as in: `roman text with some \fCcode\fR and more roman text`.

  Done in
  [`4c4d45bf92b00756739e5e83372c6aa52c83bc09`](https://git.euandreh.xyz/remembering/commit/?id=4c4d45bf92b00756739e5e83372c6aa52c83bc09).
- TODO in 2021-06-14

## DONE Document requirement on STDIN needing to be sorted {#task-ffd35082-5af0-814e-4270-9305f57aa416}
- DONE in 2021-06-13

  I've added only a small sentence, enough to say that it is at least written somewhere.

  Done in
  [`22abb6b88f1a6aa8ba9933d220f6bf3710d0a149`](https://git.euandreh.xyz/remembering/commit/?id=22abb6b88f1a6aa8ba9933d220f6bf3710d0a149).
- TODO in 2021-06-13

## DONE Use inline markings over single line "requests" on troff {#task-cb17c58a-bb00-d554-8ed8-1b53eb12b70d}
- DONE in 2021-06-12

  Done in
  [`de7838f0568e0d437822407d46d95e0269a81912`](https://git.euandreh.xyz/remembering/commit/?id=de7838f0568e0d437822407d46d95e0269a81912).
- TODO in 2021-06-12

## DONE Use monospace font inside `.EX`/`.EE` tags {#task-fe406a67-e406-41a7-df4a-1e006dc636e9}
- DONE in 2021-06-14

  Done in
  [`231dbf7038efd6a5289444108b4ea36962fe4743`](https://git.euandreh.xyz/remembering/commit/?id=231dbf7038efd6a5289444108b4ea36962fe4743).

  *Update* (2021-06-14):

  Actually the change made in `doc/remembering.*` was done, but I was using `pandoc` to visualize it and not `groff`, and I forgot to update the `Makefile` accordingly.

  Now this was done in
  [`fd96f74ebe7032172dbae0056dc399f4bf4a6842`](https://git.euandreh.xyz/remembering/commit/?id=fd96f74ebe7032172dbae0056dc399f4bf4a6842).
- TODO in 2021-06-07

## DONE What about UTF-8? {#task-19f9d131-696a-3417-c052-6312f04a33af}
- DONE in 2021-06-06

  A `test_utf8_commands` was added to verify the behaviour.
  Apparently, the current sh code already passes that.
  Since I'm not doing any significant string manipulation other than splitting by the `:` separator, it is reasonable to expect it already to work.

  This may also be true for the C implementation: by not really manipulating the string, everything after the `:` separator can be its own thing, and not be handled by remembering at all.
  The current code does not really implement that, as test/*.sh isn't even run against it.
  But at least the test is already in place so that it prevents regressions from the reimplementation.

  Done in
  [`9a9ec634d560b458b216bd1c2a7033c0b7d78339`](https://git.euandreh.xyz/remembering/commit/?id=9a9ec634d560b458b216bd1c2a7033c0b7d78339).
- TODO in 2021-06-06

---

Does the current sh implementation handle it correctly?
What about the C implementation?

It would be good to have a test stressing that.

## CANCELLED Use POSIX `$(CFLAGS)` {#task-4686d9a5-3514-e7f2-25de-b3cf66199124}
- CANCELLED in 2021-06-06

  I couldn't actually get the flags to work before claiming it to be DONE.

  Instead of just testing on the machines I have at hand right now, it would be much better to have an extensive stress test of portability, compatibility and behaviour across multiple POSIX systems.

  Having [standardify](https://euandre.org/standardify/) would definitely address this.

  Cancelled in
  [`32c4ad7eaffa7cac6ab2ea784e3bf60a6dfdaff8`](https://git.euandreh.xyz/remembering/commit/?id=32c4ad7eaffa7cac6ab2ea784e3bf60a6dfdaff8).
- DONE in 2021-06-06

  - `-std=c99` is interpreted as `-s` + `td=c99`, and a `-t` flag doesn't exist.
    Since I'm calling the `c99` command, it implies the C99 C standard, and the consumer should make sure of that.
  - `-W*` doesn't exist, neither for `-Wall` nor for `-Wl,-rpath,$$LIBRARY_PATH`;
  - `-fPIC` doesn't exist;
  - `-O3` is optional and "may be supported".
    I picked `-O1` which is defined by the specification, without meaning of which optimizations will be performed;

  I can also have all of this overriden in development with `make -e`, and switch compilers and flags for different errors, warnings, etc.

  Consumers can do the same with `make CFLAGS='...'` and similar strategies.

  Done in
  [`107d9fa6012a9312bcee9da0bf86e6fa7a34cfef`](https://git.euandreh.xyz/remembering/commit/?id=107d9fa6012a9312bcee9da0bf86e6fa7a34cfef).
- TODO in 2021-06-06

---

The current values for `$(CFLAGS)` in the `Makefile` work on GCC, Clang, TinyCC, but not on POSIX `c99`.

## TODO Can't test getopt {#task-2c3021db-7ede-c835-691a-af240c11f883}
- TODO in 2021-03-10

---

For some reason, `getopt.3` doesn't read any of the options provided in the test.

Right now the code is disabled with an [`#ifdef DISABLE`](https://git.euandreh.xyz/remembering/tree/src/remembering.c?id=461f0254ccdc4af66c1d2bfd1f34dbec0ef59218#n189) guard.

## DONE Add --version flag {#task-b001c31a-5053-d317-d8d3-c9647aa34067}
- DONE In 2021-03-10

  Done in
  [`f93524f531b9da19dc8f4d46dd4977fbbdc80f58`](https://git.euandreh.xyz/remembering/commit/?id=f93524f531b9da19dc8f4d46dd4977fbbdc80f58).
- TODO in 2021-03-09

## TODO Add AddressSanitizer and fuzzer tests {#task-8af5055c-d1e1-beba-128c-4cabc40e8057}
- TODO in 2021-03-08

---

Rich discussion on AddressSanitizer and similar tools: <https://news.ycombinator.com/item?id=26713037>.

Relevant tools:
- [scan-build](https://clang-analyzer.llvm.org/scan-build.html)
- [sanitizers](https://github.com/google/sanitizers/)
- [GCC analyzer](https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html)


## DONE Add $HOME and $XDG_DATA_HOME sh test {#task-9291a8c1-4ac3-409d-b490-872b29a719cc}
- DONE in 2021-03-06

  Done in
  [`5d999a92d6e86fd18c9bcd459e4ebf4fb356bfd5`](https://git.euandreh.xyz/remembering/commit/?id=5d999a92d6e86fd18c9bcd459e4ebf4fb356bfd5).
- TODO in 2021-03-03

## CANCELLED Rename PROFILE for LABEL? {#task-e3153cfb-b77a-4528-afa0-43b90f267d3d}
- CANCELLED in 2021-03-06

  Nope.

  "Profile" is descriptive enough, and, more importantly, it doesn't break anything.
- TODO in 2021-01-31

---

I feel a more descriptive name could be given.

Current candidates are:
- tag
- label
- name

## TODO Make `test_really_long_list` runnable {#task-c1129666-b373-4b9d-8e10-927689048b05}
- TODO in 2021-01-31

---

Now [`test_really_long_list`](https://git.euandreh.xyz/remembering/tree/tests/ranking.sh?id=f93524f531b9da19dc8f4d46dd4977fbbdc80f58#n314) is commented.

Benchmark with yeganesh after this is done.

## CANCELLED Improve speed even further {#task-05c7f068-e935-457f-89ea-1f38227e7779}
- CANCELLED in 2021-03-06

  [#task-c1129666-b373-4b9d-8e10-927689048b05](#task-c1129666-b373-4b9d-8e10-927689048b05) supersedes this.
  And even better: it has runnable code that can be executed for verifying the performance improvement.
- TODO in 2021-01-29

---

Handle 10k+ lists with ease.

## CANCELLED Add completion script {#task-daa4a3e7-bcb4-4fe1-a0df-e73c7d17e43c}
- CANCELLED in 2021-03-06

  Since there are only 2 relevant options (`-p` and `-c`) and descriptive manpages, the cost/benefit for adding code for handling completion isn't worth it.
  Worse is better.
- TODO in 2021-01-29

---

How to support multiple shells without duplicating the code?

The major one is Bash, but also consider zsh and fish. Also tcsh and oilsh.

## DONE Is tac POSIX {#task-98478c0f-97ac-4667-acdc-9373e2841de9}
- DONE in 2021-01-26
- TODO in 2021-01-26

---

If it isn't, what to replace it with?

With [sed](https://unix.stackexchange.com/questions/280685/reverse-sequence-of-a-file-with-posix-tools/280686#comment601716_280686).

## DONE Add CHANGELOG.md for 0.1.0 {#task-f4258dc4-22aa-408d-a0b1-953f654e0623}
- DONE in 2021-01-26
- TODO in 2021-01-24

## CANCELLED How to preserve to sort order from STDIN {#task-b2c26218-5f21-4efd-afbd-ff6af57a358a}
- CANCELLED in 2021-01-24

  Don't preserve.

  The "blank" order, when remembering doesn't have any date on the input (usually a new profile), is to sort the input data, and it should be this way.
  Otherwise the sort order that comes from STDIN would have to be included when showing ranked results, and use the STDIN order as a tie breaker.

  Not only this would make the code much more complex, but also understanding the behaviour of the program harder.
- TODO in 2021-01-24

---

Keeping the sort order from STDIN, I would have to find a way to
merge STDIN with the existing profile.

## DONE Make sure to forward status code given by the provided command {#task-47589312-0a4d-46ac-9f13-45309471efeb}
- DONE in 2021-01-24

  Done in commit
  [6f5e467c6bb3f0369e4220be20ab1461cd9334ce](https://git.euandreh.xyz/remembering/commit/?id=6f5e467c6bb3f0369e4220be20ab1461cd9334ce).
- TODO in 2021-01-21

## CANCELLED Exclude ponctuation from troff markup {#task-03d0e24c-4baf-404f-ac8a-f8d972ec622e}
- CANCELLED in 2021-01-04

  Changed in commit
  [6748830b5944211104061c6af15612ec270ab5a1](https://git.euandreh.xyz/remembering/commit/?id=6748830b5944211104061c6af15612ec270ab5a1).
- TODO in 2021-01-21

---

Things like:
```troff
A phrase with the last word
.B bold.
```

The final period is marked as bold, too.

## DONE Add `-h` and `--help` flags {#task-8593b78a-a5ac-4b6c-b9cf-74c021d4a8e5}
- DONE in 2021-01-24

  Done in commit
  [b0f64583bf02f84cadcfad9b610d9c02ec6c4ec2](https://git.euandreh.xyz/remembering/commit/?id=b0f64583bf02f84cadcfad9b610d9c02ec6c4ec2).
- TODO in 2021-01-21

## DONE Optimize for large lists {#task-fec292ff-b9de-4d6c-b156-a9adc4771f35}
- DONE in 2021-01-26

  Instead of using `while read VAR < $FILE`, and looping through each record,
  the `$MERGED` and `$FILTERED` files are built differently.

  Building the `$MERGED` file exploits the fact that `sort -u -k2,2` picks the first
  entry it sees, regardless of what is in column 1, or other columns. With that,
  we feed the reversed (with `tac`) list to it, and `$MERGED` is built in a single
  pass of sort.

  Building the `$FILTERED` file is now done with a simple AWK script, that performs much
  better that a `while read VAR < $FILE` loop.

  Done in commit
  [000b74b1140f2ac41cb5d00a9070db735abdc9c4](https://git.euandreh.xyz/remembering/commit/?id=000b74b1140f2ac41cb5d00a9070db735abdc9c4).
- TODO in 2021-01-21

## DONE Add tests {#task-146fab37-e53b-489e-95d0-3fcdd4c3eaef}
- DONE in 2021-01-24

  Finished in commit
  [ee6bc4f2ce6da48f25a29931a178159e5801b5d9](https://git.euandreh.xyz/remembering/commit/?id=ee6bc4f2ce6da48f25a29931a178159e5801b5d9).
- TODO in 2021-01-21

---

On plain POSIX sh.

# Bugs

# Improvements

## TODO Respond to UNIX signals {#improvement-971e21e1-1083-7507-2379-8e3127a8e359}
- TODO in 2021-06-13

## TODO Work on portability {#improvement-f7317d52-012d-7f94-e699-aec7c84329b0}
- TODO in 2021-06-13

---

Resources on writing portable C code:

- [Portability is Reliability](https://evan.nemerson.com/2021/05/04/portability-is-reliability/)
- [Why is C called a portable language?](https://www.quora.com/Why-is-C-called-a-portable-language-2?share=1)

## TODO Learn about secure programming in C {#improvement-8dfd18cf-2c34-ee29-e6cd-53d300687789}
- TODO in 2021-06-13

---

The best reference by far I've found to learn about secure programming in C is the [SEI CERT C Coding Standard](https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard).

There's also [MISRA C](https://en.wikipedia.org/wiki/MISRA_C) but it feels like very corp.

# Questions

## TODO Use more `const` in the implementation? {#question-9ad11485-c244-bf17-f83b-b627db09fab4}
- TODO in 2021-06-15

# Resources

# Scratch